﻿//----------------------------------------------------------------------
//名称：ABT(Accessibility Browser Tool) v3.2
//     无障碍辅助浏览工具条第三版
//说明：多语言版本整合
//开发：Scorpio（修改：hwp）
//日期：2012/08/23
//----------------------------------------------------------------------

//------------------------------------------------------------
//*************************初始化部分**************************
//------------------------------------------------------------
//加载配置文件--------------------------------------
function loadConfig() {
    var ABTFileUrl = document.getElementById('ABT').getAttribute('src');
    URLPrefix = '';
    if (ABTFileUrl.indexOf('/') != -1) {
        URLPrefix = ABTFileUrl.substring(0, ABTFileUrl.lastIndexOf('/') + 1);
    } else {
        URLPrefix = '';
    }
    var language = document.getElementsByTagName('HTML')[0].getAttribute('lang');
    var langCode = language && language == 'zh_CN' ? 'cn' : language;

    document.write(
        '<script type="text/javascript" charset="UTF-8" src="' +
            URLPrefix +
            'config/config_' +
            langCode +
            '.js"></script>'
    );
    document.write('<script type="text/javascript" charset="UTF-8" src="' + URLPrefix + 'pinyin/pinyin.js"></script>');
    document.write(
        '<link rel="stylesheet" type="text/css" charset="UTF-8" id="ABTStyle" href="' +
            URLPrefix +
            'skins/jinganGov/skin_' +
            langCode +
            '.css" />'
    );
    var ABTBG = new Image();
    ABTBG.src = URLPrefix + 'skins/jinganGov/images/newbg.gif';
}

var $body = $('body');

loadConfig();
//页面加载完毕运行----------------------------------
if (window.addEventListener) {
    window.addEventListener('load', Initialization, false);
} else {
    window.attachEvent('onload', Initialization);
}
//工具条初始化--------------------------------------
var pageLoaded = false;
function Initialization() {
    pageLoaded = true;
    declareConfig();
    if (ABTConfig.mainSwitch) {
        browserTypeCheck();
        getElements(ABTConfig.container);
        iframeKeyListenerWrite();
        toolbar.skin = ABTConfig.defaultSkin;
        toolbar.cookie.readCookie();
    }
}
//键盘事件监听--------------------------------------
document.onkeydown = function keyListener(e) {
    if (!pageLoaded) {
        return;
    }
    var currkey = 0,
        e = e || event;
    currkey = e.keyCode || e.which || e.charCode;
    toolbar.keyboardListener(e.ctrlKey, e.altKey, e.shiftKey, currkey);
};
//------------------------------------------------------------
//************************公用函数部分**************************
//------------------------------------------------------------
//浏览器类型判断函数--------------------------------
function browserTypeCheck() {
    browserType = {};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/))
        ? (browserType.ie = s[1])
        : (s = ua.match(/firefox\/([\d.]+)/))
        ? (browserType.firefox = s[1])
        : (s = ua.match(/chrome\/([\d.]+)/))
        ? (browserType.chrome = s[1])
        : (s = ua.match(/opera.([\d.]+)/))
        ? (browserType.opera = s[1])
        : (s = ua.match(/version\/([\d.]+).*safari/))
        ? (browserType.safari = s[1])
        : 0;
}
//公用节点获取函数----------------------------------
function getElements(elementId) {
    getE = new Object();
    if (document.getElementById(elementId)) {
        getE.container = document.getElementById(elementId);
        getE.allElements = getE.container.getElementsByTagName('*');
        getE.allImg = getE.container.getElementsByTagName('img');
        getE.allFrame = getE.container.getElementsByTagName('iframe');
        getE.allStyle = document.getElementsByTagName('head')[0].getElementsByTagName('link');
        getE.allScript = document.getElementsByTagName('head')[0].getElementsByTagName('script');
        getE.error = false;
    } else {
        getE.error = true;
    }
}
//文字键盘码处理函数--------------------------------
function keyCodeStringHandle(keyString) {
    var thisKeyString = '';
    thisKeyString += String(keyString.toUpperCase().indexOf('CTRL') > -1 ? 1 : 0);
    thisKeyString += String(keyString.toUpperCase().indexOf('ALT') > -1 ? 1 : 0);
    thisKeyString += String(keyString.toUpperCase().indexOf('SHIFT') > -1 ? 1 : 0);
    thisKeyString += keyString.toUpperCase().substring(keyString.toUpperCase().lastIndexOf('+') + 1);
    return thisKeyString;
}
//跳转节点建立函数----------------------------------
function skipElementBuild(element, elementText) {
    if (!element) {
        return;
    }
    var shipElement = document.createElement('div');
    shipElement.setAttribute('class', ABTConfig.skipClassName);
    shipElement.style.cssText = 'width:0px;height:0px;font-size:0px;line-height:0px;';
    shipElement.innerHTML =
        '<a href="javascript:" title="' + elementText + '" onblur="skipElementRemove(this)">' + elementText + '</a>';
    element.parentNode.insertBefore(shipElement, element);
    window.setTimeout(function () {
        shipElement.firstChild.focus();
    }, 10);
}
//跳转节点删除函数----------------------------------
function skipElementRemove(skipElement) {
    skipElement.parentNode.parentNode.removeChild(skipElement.parentNode);
}
//获取文本功能函数----------------------------------
// function getText(element) {
//     var elementText;
//     if (
//         element.nodeName == 'H1' ||
//         element.nodeName == 'H2' ||
//         element.nodeName == 'H3' ||
//         element.nodeName == 'H4' ||
//         element.nodeName == 'H5' ||
//         element.nodeName == 'H6'
//     ) {
//         if (element.firstChild.nodeName == '#text') {
//             if (element.firstChild.nodeValue.trim() == '') {
//                 if (element.childNodes.length > 1) {
//                     element = element.childNodes[1];
//                 } else {
//                     element = element.firstChild;
//                 }
//             } else {
//                 element = element.firstChild;
//             }
//         } else {
//             element = element.firstChild;
//         }
//     }
//     if (element.nodeName == '#text') {
//         elementText = element.nodeValue;
//     } else if (element.nodeName == 'IMG') {
//         if (element.getAttribute('alt')) {
//             elementText = element.getAttribute('alt');
//         } else if (element.getAttribute('title')) {
//             elementText = element.getAttribute('title');
//         } else {
//             elementText = document.title;
//         }
//     } else {
//         elementText = element.innerText || element.textContent;
//     }
//     return elementText;
// }
//iframe键盘监听函数--------------------------------
function iframeKeyListenerWrite() {
    if (getE.error) {
        return;
    }
    for (var i = 0; i < getE.allFrame.length; i++) {
        var iframeDOM = getE.allFrame[i].contentWindow;
        try {
            var scriptElement = iframeDOM.document.createElement('script');
            scriptElement.setAttribute('type', 'text/javascript');
            scriptElement.text =
                'document.onkeydown = function(e){var e=e||event;document.parentWindow.parent.keyListener(e);}';
            iframeDOM.document.getElementsByTagName('head')[0].appendChild(scriptElement);
        } catch (e) {}
    }
}
//------------------------------------------------------------
//*************************工具条部分**************************
//------------------------------------------------------------
//工具条键盘监听------------------------------------
toolbar.keyboardListener = function (ctrlKey, altKey, shiftKey, otherKey) {
    if (getE.error) {
        return;
    }
    var keyNum = '';
    keyNum += String(ctrlKey ? 1 : 0);
    keyNum += String(altKey ? 1 : 0);
    keyNum += String(shiftKey ? 1 : 0);
    for (var a in toolbar.Function) {
        try {
            toolbar.Function[a].keyTrigger(keyNum + String.fromCharCode(otherKey).toUpperCase());
        } catch (f) {}
    }
};
//工具条cookie存取----------------------------------
toolbar.cookie = new Object();
toolbar.cookie.setCookie = function (cookieName, cookieValue) {
    if (cookieName == undefined || cookieValue == undefined) {
        return;
    }
    var Days = ABTConfig.cookieTime;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = cookieName + '=' + escape(cookieValue) + ';expires=' + exp.toGMTString() + ';path=/;';
};
toolbar.cookie.getCookie = function (name) {
    if (name == undefined) {
        return;
    }
    var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
    if (arr != null) return unescape(arr[2]);
    return null;
};
toolbar.cookie.readCookie = function () {
    if (!ABTConfig.cookieSwitch || getE.error) {
        return;
    }
    for (var a in toolbar.Function) {
        try {
            toolbar.Function[a].cookieMethod();
        } catch (e) {}
    }
};
//--------------------------------------------------
//*****************工具条具体功能部分*****************
//--------------------------------------------------
toolbar.Function = new Object();
//区域跳转功能--------------------------------------
toolbar.Function.areaSkip = {
    keyTrigger: function (keyString) {
        var customizeAreaSkip = ABTConfig.areaSkip.delimit;
        for (var a = 0; a < customizeAreaSkip.length; a++) {
            if (keyString == keyCodeStringHandle(customizeAreaSkip[a].split(':')[2])) {
                toolbar.Function.areaSkip.mainMethod(
                    customizeAreaSkip[a].split(':')[0],
                    customizeAreaSkip[a].split(':')[1]
                );
            }
        }
    },
    mainMethod: function (areaId, elementText) {
        if (!ABTConfig.areaSkip.functionSwitch) {
            return;
        }
        if (langCode == 'cn') {
            if (document.getElementById(areaId)) {
                skipElementBuild(document.getElementById(areaId), elementText);
            } else {
                var newPromptText = '当前页面无' + elementText.substring(5) + '，已为您跳转到页面头部区域';
                skipElementBuild(document.getElementById('skip'), newPromptText);
            }
        } else {
            skipElementBuild(document.getElementById(areaId), elementText);
        }
    }
};
//自定义跳转功能------------------------------------
toolbar.Function.customSkip = {
    keyTrigger: function (keyString) {
        var nextKeyCode = ABTConfig.customSkip.nextKeyCode;
        var previousKeyCode = ABTConfig.customSkip.previousKeyCode;
        for (var a = 0; a < nextKeyCode.length; a++) {
            if (keyString == keyCodeStringHandle(nextKeyCode[a])) {
                toolbar.Function.customSkip.mainMethod(0);
            }
        }
        for (var a = 0; a < previousKeyCode.length; a++) {
            if (keyString == keyCodeStringHandle(previousKeyCode[a])) {
                toolbar.Function.customSkip.mainMethod(1);
            }
        }
    },
    getCustomSkip: function () {
        var switchValue = ABTConfig.customSkip.delimit;
        var allCustomElement = new Array();
        var allColumnNum = 0;
        for (var a = 0; a < getE.allElements.length; a++) {
            for (var b = 0; b < switchValue.length; b++) {
                var tempVar = switchValue[b].split(':');
                if (
                    (tempVar[0] == 'tagName' && getE.allElements[a].nodeName == tempVar[1]) ||
                    (tempVar[0] == 'tagId' && getE.allElements[a].getAttribute('id') == tempVar[1])
                ) {
                    if (getE.allElements[a].offsetHeight + getE.allElements[a].offsetWidth != 0) {
                        allCustomElement[allColumnNum] = {
                            element: getE.allElements[a],
                            elementTips: tempVar[2],
                            elementType: tempVar[0]
                        };
                    }
                    allColumnNum++;
                }
            }
        }
        return allCustomElement;
    },
    firstRun: true,
    customElementGroup: new Array(),
    nowElementNum: -1,
    mainMethod: function (skipDirection) {
        if (!ABTConfig.customSkip.functionSwitch) {
            return;
        }
        if (this.firstRun) {
            this.customElementGroup = this.getCustomSkip();
            this.firstRun = false;
        }
        if (skipDirection == 0) {
            this.nowElementNum++;
            if (this.nowElementNum > this.customElementGroup.length - 1) {
                this.nowElementNum = this.customElementGroup.length - 1;
            }
        } else if (skipDirection == 1) {
            this.nowElementNum--;
            if (this.nowElementNum < 0) {
                this.nowElementNum = 0;
            }
        }
        if (this.customElementGroup.length == 0) {
            return;
        }
        var nodeText = '';
        if (this.customElementGroup[this.nowElementNum].elementType != 'tagId') {
            nodeText = getText(this.customElementGroup[this.nowElementNum].element);
            if (nodeText == undefined) {
                nodeText = '';
            }
        }
        nodeText += this.customElementGroup[this.nowElementNum].elementTips;
        skipElementBuild(this.customElementGroup[this.nowElementNum].element, nodeText);
    }
};

//适老模式功能----------------------------------------
toolbar.Function.oldstate = {
    showHTML: function () {
        if (ABTConfig.guides.functionSwitch && toolbar.config.oldstate.show) {
            var resHtml =
                '<li id="oldbutton"><a  href="javascript:toolbar.Function.oldstate.mainMethod()"   onmousemove=toolbar.config.oldstate.onmousemove(this) title="' +
                toolbar.Function.guidance.infoArry[0].info +
                '"  onmouseout=toolbar.config.oldstate.onmouseout(this)><i style="' +
                toolbar.config.oldstate.style +
                '"></i></a></li>';

            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'mouseState',
    // cookieMethod: function () {
    //     if (ABTConfig.guides.cookieSwitch && toolbar.cookie.getCookie(this.cookieName) == 1) {
    //         toolbar.Function.oldstate.mainMethod();
    //     }
    // },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    mouseState: false,
    mainMethod: function () {
        // if (!this.mouseState) {
        //     var dom = document.createElement('style');
        //     dom.id = 'mousewrap';
        //     dom.innerHTML = '* {cursor:url("./js/ABT/skins/jinganGov/images/linkaw.cur"), auto !important;}';
        //     document.getElementById('container').appendChild(dom);
        //     this.mouseState = true;
        // } else {
        //     document.getElementById('mousewrap').remove();
        //     this.mouseState = false;
        // }
        // toolbar.cookie.setCookie(this.cookieName, this.mouseState ? 1 : 0);

        var oldHtml =
            '<div class="abt-old" id="oldstate">' +
            '<div class="abt-pop-wrap">' +
            '<div class="abt-pop-top">' +
            '<h3>欢迎使用长者辅助浏览<i></i>请选择适合您的长者模式</h3>' +
            '<a class="abt-close-btn" href="javascript:;"></a>' +
            '</div>' +
            '<ul class="abt-pop-list">' +
            '    <li>' +
            '<a class="abt-pop-item" href="javascript:;" data-type="normal">' +
            '<p class="abt-pop-type">普通</p>' +
            '<p class="abt-pop-tip">您好！如果您觉得这个字体大小合适，请选择该模式。</p>' +
            '</a>' +
            '</li>' +
            '<li>' +
            '<a class="abt-pop-item" href="javascript:;" data-type="middle">' +
            '<p class="abt-pop-type">中等</p>' +
            '<p class="abt-pop-tip">您好！如果您觉得这个字体大小合适，请选择该模式。</p>' +
            '</a>' +
            '</li>' +
            '<li>' +
            '<a class="abt-pop-item" href="javascript:;" data-type="high">' +
            '<p class="abt-pop-type">高等</p>' +
            '<p class="abt-pop-tip">您好！如果您觉得这个字体大小合适，请选择该模式。</p>' +
            '</a>' +
            '</li>' +
            '</ul>' +
            '<p class="foot-abt-tip">关闭此页面后，可点击页面顶部的『无障碍浏览』开启无障碍工具条，再点击『适老模式』按钮重新开启</p>' +
            '</div>' +
            '</div>';
        $body.append(oldHtml);
    }
};

$body.on('click', '.abt-close-btn', function () {
    $('#oldstate').remove();
});

//适老模式切换
$body.on('click', '.abt-pop-item', function () {
    var type = $(this).data('type');
    if (type === 'normal') {
        //普通模式
        toolbar.cookie.setCookie('textTips', 0);
        toolbar.cookie.setCookie('pageZoomState', 1);
        toolbar.cookie.setCookie('fontZoomState', 0);
        window.location.reload();
    } else if (type === 'middle') {
        //中等模式
        toolbar.cookie.setCookie('textTips', 1);
        toolbar.cookie.setCookie('pageZoomState', 1.4);
        toolbar.cookie.setCookie('fontZoomState', 22);
        window.location.reload();
    } else {
        //高等模式
        window.location.href = toolbar.config.oldstate.oldUrl;
    }

    $('#oldstate').remove();
});

//语音指读功能------------------------------------
toolbar.Function.overSoundMode = {
    showHTML: function () {
        if (toolbar.config.overSound.show) {
            // var buttonText = this.overSoundModeState
            //     ? ABTConfig.language.overSoundMode.on
            //     : ABTConfig.language.overSoundMode.off;
            var resHtml = '';
            if (this.overSoundModeState) {
                resHtml =
                    '<li id="overSoundModebutton"><a  title="' +
                    toolbar.Function.guidance.infoArry[1].info +
                    '" href="javascript:toolbar.Function.overSoundMode.mainMethod()" onmousemove=toolbar.config.overSound.onmousemove(this)  onmouseout=toolbar.config.overSound.onmouseout(this)><i style="' +
                    toolbar.config.overSound.statebg0 +
                    '"></i></a></li>';
            } else {
                resHtml =
                    '<li id="overSoundModebutton"><a  title="' +
                    toolbar.Function.guidance.infoArry[1].info +
                    '" href="javascript:toolbar.Function.overSoundMode.mainMethod()" onmousemove=toolbar.config.overSound.onmousemove(this)  onmouseout=toolbar.config.overSound.onmouseout(this)><i style="' +
                    toolbar.config.overSound.style +
                    '"></i></a></li>';
            }

            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'overSoundModeState',
    cookieMethod: function () {
        if (toolbar.cookie.getCookie(this.cookieName) === '1') {
            toolbar.Function.overSoundMode.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    overSoundModeState: false,
    mainMethod: function () {
        if (!ABTConfig.overSoundMode.functionSwitch || getE.error) {
            return;
        }
        if (!this.overSoundModeState) {
            //开启
            if (document.getElementById('overSoundModebutton')) {
                $('#overSoundModebutton img').addClass('check');
            }
            this.overSoundModeState = true;

            startSoundMode();
            $('#overSoundModebutton').find('i').attr({
                style: toolbar.config.overSound.statebg0
            });

            toolbar.Function.continuous.continuous = true;
            toolbar.Function.continuous.mainMethod();
            $('#continuousbutton').find('i').attr({
                style: toolbar.config.continuous.style
            });
        } else {
            if (document.getElementById('overSoundModebutton')) {
                $('#overSoundModebutton img').removeClass('check');
            }
            this.overSoundModeState = false;
            $('#overSoundModebutton').find('i').attr({
                style: toolbar.config.overSound.style
            });
        }
        toolbar.cookie.setCookie(this.cookieName, this.overSoundModeState ? 1 : 0);
    }
};

var isVisible = function (node, pnode) {
    // console.log(node);
    // pnode = pnode ? pnode : node.ownerDocument.body;
    // if (node.nodeName == 'BODY' || node.nodeName == 'HTML' || node == pnode) return true;
    // if (!node || !node.parentNode) return false;
    // if (node.style && (node.style.display == 'none' || node.style.visibility == 'hidden')) return false;
    // if (window.getComputedStyle) {
    //     var style = window.getComputedStyle(node, '');
    //     if (style.display == 'none' || style.visibility == 'hidden') return false;
    // } else {
    //     var style = node.currentStyle;
    //     if (style && (style['display'] == 'none' || style['visibility'] == 'hidden')) return false;
    // }
    // return this.isVisible(node.parentNode, pnode);
    // if($(node).attr('readIndex'))
};

toolbar.readtarget = '';
toolbar.prenode = '';

// $('#container').bind('mouseover', function (e) {
//     if ($(e.target).attr('readindex')) {
//         toolbar.readtarget = e.target;
//     }
// });

//连读功能
toolbar.Function.continuous = {
    showHTML: function () {
        if (toolbar.config.continuous.show) {
            var statebg = toolbar.config.continuous.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 1) {
                statebg = toolbar.config.continuous.statebg0;
            }
            var resHtml =
                '<li id="continuousbutton"><a  title="' +
                toolbar.Function.guidance.infoArry[2].info +
                '" href="javascript:toolbar.Function.continuous.mainMethod()" onmousemove=toolbar.config.continuous.onmousemove(this)  onmouseout=toolbar.config.continuous.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'continuous',
    cookieMethod: function () {
        if (toolbar.cookie.getCookie(this.cookieName) === '1') {
            toolbar.Function.continuous.mainMethod();
        }
    },
    readindex: 0,
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    continuous: false,
    mainMethod: function () {
        var $continusimg = $('#continuousbutton img');

        if (!this.continuous) {
            stopSpeak();
            this.continuous = true;
            speakText(toolbar.config.continuous.starSound, false);
            setTimeout(function () {
                toolbar.Function.readcontinu(toolbar.readtarget);
            }, toolbar.config.continuous.starTimes);
            $('#continuousbutton').find('i').attr({
                style: toolbar.config.continuous.statebg0
            });
            toolbar.Function.overSoundMode.overSoundModeState = true;
            toolbar.Function.overSoundMode.mainMethod();
            $('#overSoundModebutton').find('i').attr({
                style: toolbar.config.overSound.style
            });
        } else {
            $('#continuousbutton').find('i').attr({
                style: toolbar.config.continuous.style
            });
            this.continuous = false;
        }

        toolbar.cookie.setCookie(this.cookieName, this.continuous ? 1 : 0);
    }
};

//连读方法
toolbar.Function.readcontinu = function (node) {
    var texts = {
        firstVisit: '\u6b22\u8fce\u8bbf\u95ee{title}{pagetype}\u9875\u9762',
        againVisit: '\u5df2\u6253\u5f00{title}{pagetype}\u9875\u9762',
        noRegion:
            '\u672c\u9875\u9762\u6682\u65e0\u667a\u80fd\u5bfc\u76f2\uff0c\u6309\u4e0b\u5236\u8868\u952eTab\u952e\u6d4f\u89c8\u4fe1\u606f',
        countRegion: '{len}\u4e2a{name}\u3001',
        imginfo: '{imgcount}\u5f20\u56fe\u7247',
        notAccess: '\u64cd\u4f5c\u65e0\u6548\uff0c\u672c\u9875\u9762\u6ca1\u6709\u8be5\u7c7b\u522b\u7684\u533a\u57df',
        pageForm:
            '\u672c\u9875\u9762\u662f\u7531{regioninfo}\u5171\u8ba1{count}\u4e2a\u533a\u57df\u7ec4\u6210{pressinfo}\uff0c\u64cd\u4f5c\u5e2e\u52a9\u8bf7\u6309Alt\u52a0\u95ee\u53f7\u952e\u3002',
        areaHelp:
            '\u6309\u952e\u8bf4\u660e\uff1aAlt\u52a00\u952e\u64ad\u653e\u9875\u9762\u7ed3\u6784\u7ec4\u6210\uff0cAlt\u52a0\u4e0b\u952e\u5411\u4e0b\u5207\u6362\u533a\u57df\uff0cAlt\u52a0\u4e0a\u952e\u5411\u4e0a\u5207\u6362\u533a\u57df\uff0cAlt\u52a01\u952e\u5207\u6362\u5bfc\u822a\u533a\uff0cAlt\u52a02\u952e\u5207\u6362\u89c6\u7a97\u533a\uff0cAlt\u52a04\u952e\u5207\u6362\u4ea4\u4e92\u533a\uff0cAlt\u52a05\u952e\u5b9a\u4f4d\u5217\u8868\u533a\uff0cAlt\u52a06\u952e\u5b9a\u4f4d\u6b63\u6587\u533a\uff0cAlt\u52a07\u952e\u5207\u6362\u670d\u52a1\u533a\uff0c\u5236\u8868\u952e(Tab)\u6d4f\u89c8\u4fe1\u606f\uff0cCtrl\u52a0Shift\u52a0C\u952e\u6e05\u9664\u7f51\u9875\u4e2d\u58f0\u97f3\uff0c\u83b7\u53d6\u6574\u4f53\u5e2e\u52a9\u8bf7\u6309Shift\u52a0\u95ee\u53f7\u952e',
        exitBlind:
            '\u5f53\u524d\u7248\u672c\u4e0d\u53ef\u4ee5\u7528\u9f20\u6807\u64cd\u4f5c\u7f51\u9875\u3002\u5982\u9700\u9000\u51fa\uff0c\u8bf7\u5355\u51fb\u53f3\u4e0a\u89d2\u7684\u9000\u51fa\u6309\u94ae',
        listForm:
            '\u672c\u533a\u57df\u542b\u6709{linkcount}\u4e2a\u94fe\u63a5{imginfo}\uff0c\u6309\u4e0bTab\u952e\u6d4f\u89c8\u4fe1\u606f',
        listaForm:
            '\u672c\u533a\u57df\u542b\u6709{sencount}\u53e5\u5185\u5bb9{imginfo}\uff0c\u6309\u4e0bTab\u952e\u6d4f\u89c8\u4fe1\u606f',
        mutualForm: '\u672c\u533a\u57df\u542b\u6709{regioninfo}\uff0c\u6309\u4e0bTab\u952e\u6d4f\u89c8\u4fe1\u606f',
        contentForm:
            '\u672c\u6587\u4e2d\u5171\u542b\u6709{imginfo}{p}\u4e2a\u6bb5\u843d\uff0c{w}\u4e2a\u6c49\u5b57\uff0c\u6717\u8bfb\u5927\u7ea6\u9700\u8981{minute}\u5206\u949f,\u6309\u4e0bTab\u952e\u5f00\u59cb\u6717\u8bfb',
        regionStart: '\u63d0\u793a:\u60a8\u5df2\u8fdb\u5165{title}',
        regionEnd: '\u63d0\u793a:\u60a8\u5df2\u79bb\u5f00{title}',
        page1: '\u7efc\u5408',
        page2: '\u5217\u8868',
        page3: '\u6b63\u6587',
        press1: '',
        press2: '\uff0c\u5b9a\u4f4d\u5230\u5217\u8868\u533a\u8bf7\u6309Alt\u52a05\u952e',
        press3: '\uff0c\u5b9a\u4f4d\u5230\u6b63\u6587\u533a\u8bf7\u6309Alt\u52a06\u952e',
        content: '\u6b63\u6587\u533a',
        list: '\u5217\u8868\u533a',
        slist: '\u89c6\u7a97\u533a',
        mutual: '\u4ea4\u4e92\u533a',
        dir: '\u5bfc\u822a\u533a',
        site: '\u670d\u52a1\u533a',
        regionName: '\u533a\u57df',
        help: '\u5e2e\u52a9',
        blindWay: '\u8bf4\u660e',
        exit: '\u9000\u51fa\u7cfb\u7edf',
        a: '\u94fe\u63a5',
        link: '\u94fe\u63a5',
        currentValue: '\u5f53\u524d\u5185\u5bb9\u4e3a',
        currentItem: '\u5f53\u524d\u9009\u4e2d\u9879\u4e3a',
        current: '\u5f53\u524d',
        emptyContent: '\u7a7a',
        file: '\u6587\u4ef6\u4e0a\u4f20\u9009\u62e9\u6309\u94ae',
        password: '\u5bc6\u7801\u8f93\u5165\u6846',
        reset: '\u91cd\u65b0\u8bbe\u7f6e\u6309\u94ae',
        object: '\u5a92\u4f53',
        embed: '\u5a92\u4f53',
        abbr: '\u9996\u5b57\u6bcd\u7f29\u5199',
        acronym: '\u9996\u5b57\u6bcd\u7f29\u5199',
        area: '\u70ed\u70b9\u94fe\u63a5',
        imageButton: '\u56fe\u7247\u6309\u94ae',
        button: '\u6309\u94ae',
        submit: '\u63d0\u4ea4\u6309\u94ae',
        h1: '\u6807\u9898',
        h2: '\u6807\u9898',
        h3: '',
        h4: '',
        h5: '',
        h6: '',
        hr: '\u6a2a\u7ebf',
        img: '\u56fe\u7247',
        label: '\u6807\u7b7e',
        li: '\u5217\u8868\u9879\u76ee',
        marquee: '\u6eda\u52a8\u6587\u672c',
        ol: '\u6709\u5e8f\u5217\u8868',
        option: '\u5217\u8868\u6846\u9009\u9879',
        p: '\u6bb5\u843d',
        select: '\u5217\u8868\u6846',
        strong: '\u7c97\u4f53',
        table: '\u8868\u683c',
        tbody: '\u8868\u683c\u4e3b\u4f53',
        td: '\u5355\u5143\u683c',
        radio: '\u5355\u9009\u6309\u94ae',
        checkbox: '\u590d\u9009\u6309\u94ae',
        checked: '\u5df2\u9009\u4e2d',
        unchecked: '\u672a\u9009\u4e2d',
        text: '\u6587\u672c\u8f93\u5165\u6846',
        textarea: '\u591a\u6587\u672c\u8f93\u5165\u6846\u5185\u5bb9\u4e3a:',
        tfoot: '\u8868\u5c3e',
        ul: '\u65e0\u5e8f\u5217\u8868'
    };

    var removeSpecialCharacters = function (str) {
        var i = 0;
        var chr = '';
        var newStr = '';
        if (!str) return '';
        str = trim(str);
        str = str.split('&nbsp;').join('');
        if (str.length < 3) str = str.replace(/[~!@#\$\%\^&\*\(\)\-\_\+\=\[\]\{\}\<\>\.]/gi, '');
        for (i = 0; i < str.length; i++) {
            chr = str.charAt(i);
            if (
                chr == '	' ||
                chr == '¡¡' ||
                (chr == ' ' && i < str.length - 1 && str.charAt(i + 1) == ' ') ||
                chr == '\r' ||
                chr == '\n' ||
                chr == '$' ||
                chr == '#' ||
                chr == '|' ||
                chr == '\\' ||
                chr == '&'
            ) {
                chr = '';
            } else {
                newStr += chr;
            }
        }
        return newStr;
    };

    var getInputLabelText = function (node) {
        var cNode = $(node).parent();
        if (cNode) {
            var text = removeSpecialCharacters(cNode.text());
            if (text && text.length < 6) return cNode.text();
            if (cNode.get(0).tagName == 'TD' && cNode.prev() && cNode.prev().get(0).tagName == 'TD')
                return cNode.prev().text();
            cNode = cNode.parent().children().length >= 2 ? cNode.prev() : cNode.parent().prev();
        }
        if (cNode.find('a,li,span,label').length > 1) return '';
        if (cNode) {
            var text = removeSpecialCharacters(cNode.text());
            return text && text.length < 7 ? text : '';
        }
        return '';
    };

    var get = function (label, obj) {
        if (obj && typeof obj == 'object') {
            if (!texts[label]) return '';
            var text = texts[label];
            for (var key in obj) {
                var reg = new RegExp('{' + key + '}', 'ig');
                text = text.replace(reg, obj[key]);
            }
            return text;
        }
        return texts[label] ? texts[label] : '';
    };

    var handleElement = function (elem) {
        var result = '';
        $('script,style', elem).remove();
        switch (elem.tagName) {
            case 'A':
                var textc = $(elem).text();
                textc = textc ? textc.replace(/¡­$/, '').replace(/\.\.\.$/, '') : '';
                var titlec = $(elem).attr('title');
                result = get('a') + ' ' + (titlec && titlec.length >= textc.length - 2 ? titlec : textc);
                break;
            case 'AREA':
                var titlec = $(elem).attr('title');
                result = get('area') + ' ' + (titlec ? titlec : '');
                break;
            case 'BUTTON':
                var val = elem.value ? elem.value : '';
                val = val.replace(/\s/g, '');
                result = val + get('button');
                break;
            case 'OBJECT':
            case 'EMBED':
                var titlec = $(elem).attr('title');
                result = get(elem.tagName.toLowerCase()) + ' ' + (titlec ? titlec : '');
                break;
            case 'H1':
            case 'H2':
            case 'H3':
            case 'H4':
            case 'H5':
            case 'H6':
                result = get(elem.tagName.toLowerCase()) + ' ' + $(elem).text();
                break;
            case 'IMG':
                var imgText = $(elem).attr('title');
                imgText = imgText ? imgText : $(elem).attr('alt');
                result = get('img') + ' ' + (imgText ? imgText : '');
                break;
            case 'INPUT':
                result = handleInputNode(elem);
                break;
            case 'SELECT':
                result += get('select') + ',' + get('currentItem') + elem.options[elem.selectedIndex].text;
                break;
            case 'TEXTAREA':
                var value = '';
                try {
                    value = elem.value ? elem.value : get('emptyContent');
                } catch (err) {}
                result = get('textarea') + ',' + get('currentValue') + value;
                break;
            default:
                break;
        }
        if (elem.getAttribute('title') && !result) result = elem.getAttribute('title');
        return result;
    };

    var handleInputNode = function (elem) {
        var result = '';
        var attrType = elem.getAttribute('type');
        attrType = attrType ? attrType : 'text';
        switch (attrType) {
            case 'button':
                result = elem.value + get('button');
                break;
            case 'checkbox':
                result =
                    getInputLabelText(elem) +
                    get('checkbox') +
                    ' ' +
                    get('current') +
                    (elem.checked == true ? get('checked') : get('unchecked'));
                break;
            case 'file':
                result = get('file');
                break;
            case 'image':
                result = elem.value + get('imageButton');
                break;
            case 'password':
                result = get('password');
                break;
            case 'radio':
                result =
                    getInputLabelText(elem) +
                    get('radio') +
                    ' ' +
                    get('current') +
                    (elem.checked == true ? get('checked') : get('unchecked'));
                break;
            case 'reset':
                result = elem.value + get('reset');
                break;
            case 'submit':
                result = elem.value + get('submit');
                break;
            case 'hidden':
                break;
            case 'text':
                var value = '';
                try {
                    value = elem.value ? elem.value : get('emptyContent');
                } catch (err) {}
                result = getInputLabelText(elem) + get('text') + get('currentValue') + value;
            default:
                break;
        }
        return result;
    };

    var handleNode = function (node, goingDown) {
        if (!goingDown || !node) return '';
        var return_val = '';
        switch (node.nodeType) {
            case 1:
                // if (!this.isVisible(node)) {
                //     return_val = '';
                // } else {
                return_val = handleElement(node);
                // }
                break;
            case 2:
                return_val = '';
                break;
            case 3:
                return_val = node.data;
                if (return_val.length > 0 && return_val.match(/[^\s,\.\?!:\-]/)) {
                    return_val = ret_val.replace(/&#\d+;/, '');
                } else {
                    return_val = '';
                }
                break;
            case 8:
            case 9:
            case 10:
            default:
                return_val = '';
        }
        return return_val;
    };

    var trim = function (str) {
        return str ? str.replace(/(^\s+)|(\s+$)/g, '') : '';
    };

    var RemoveSpecialCharacters = function (a) {
        var d,
            f = '';
        if (!a) return '';
        a = trim(a);
        a = a.split('&nbsp;').join('');
        3 > a.length && (a = a.replace(/[~!@#\$%\^&\*\(\)\-_\+=\[\]\{\}<>\.]/gi, ''));
        for (d = 0; d < a.length; d++) {
            var e = a.charAt(d);
            '\t' == e ||
                '\u3000' == e ||
                (' ' == e && d < a.length - 1 && ' ' == a.charAt(d + 1)) ||
                '\r' == e ||
                '\n' == e ||
                '$' == e ||
                '#' == e ||
                '|' == e ||
                '\\' == e ||
                '&' == e ||
                (f += e);
        }
        return f;
    };

    var getImgLinkText = function (node) {
        if (node.tagName == 'A' && $('>img', node).length > 0) {
            var tempImgNode = $('>img', node).get(0);
            var text = $(tempImgNode).attr('alt');
            if (!text) text = $(tempImgNode).attr('title');
            if (!text) text = $(node).attr('title');
            text = text ? ':' + text : '';

            return '链接' + text;
        }
        return '';
    };

    var getNodeText = function (node) {
        if ($('.accnode', node).length > 0) {
            node = $(node).clone().get(0);
            $('.accnode', node).remove();
        }
        var text = handleNode(node, true);
        if (!text) text = node.innerText == undefined ? node.textContent : node.innerText;
        text = RemoveSpecialCharacters(text);
        var srcText = $(node).text();
        srcText = srcText ? srcText.replace(/\s/g, '') : '';
        if (text && RemoveSpecialCharacters(srcText)) return text;
        if (!text || $('img', node).length > 0) text = getImgLinkText(node);
        return text;
    };

    var scroll = function (node, arrow) {
        var stop = $(node).offset().top - $(window).height() / 2;
        $(node.ownerDocument).scrollTop(stop);
        var locateNode = node.ownerDocument.createElement('a');
        $(locateNode)
            .attr({
                href: '#',
                target: '_self'
            })
            .css({
                display: 'block',
                position: 'relative',
                width: '1px',
                height: '1px'
            })
            .html('&nbsp;');
        if (arrow == 'up') {
            node.parentNode.insertBefore(locateNode, node);
        } else {
            if (node.nextSibling) {
                node.parentNode.insertBefore(locateNode, node.nextSibling);
            } else {
                $(node.parentNode).append(locateNode);
            }
        }
        $(locateNode).focus();
        $(locateNode).remove();
    };

    var eachLeaf = function (node, first, isKey) {
        if (!node) {
            node = $('[readindex=0]').get(0);
        }
        var idx;
        // if (toolbar.Function.continuous.readindex != 1) {
        //     idx = toolbar.Function.continuous.readindex;
        // } else {
        //     idx = $(node).attr('readindex');
        // }
        idx = $(node).attr('readindex');
        idx = parseInt(idx);
        toolbar.prenode = toolbar.Function.leafs.length > idx + 1 ? toolbar.Function.leafs[idx + 1] : null;

        toolbar.readtarget = toolbar.prenode;
        var text = node ? getNodeText(node) : '';
        // if (assist.global.touchNode) $(assist.global.touchNode).removeClass('accfocus');
        $(node).addClass('accfocus');
        // assist.global.touchNode = node;
        // assist.module.wza.screen.tip(text);
        scroll(node);
        // assist.global.overNode = assist.module.node.triggerTouch(node) || assist.global.overNode;
        // eachLeaf(prenode, false, isKey);
        speakText(text, true);

        return true;
    };

    eachLeaf(node, false);
};

//语速调整功能
toolbar.Function.speed = {
    showHTML: function () {
        if (toolbar.config.speed.show) {
            var statebg = toolbar.config.speed.style;
            if (toolbar.cookie.getCookie(this.cookieName) === '快') {
                statebg = toolbar.config.speed.statebg0;
            } else if (toolbar.cookie.getCookie(this.cookieName) === '慢') {
                statebg = toolbar.config.speed.statebg1;
            }
            var resHtml =
                '<li id="speedbutton"><a  title="' +
                toolbar.Function.guidance.infoArry[3].info +
                '" href="javascript:toolbar.Function.speed.mainMethod()" onmousemove=toolbar.config.speed.onmousemove(this)  onmouseout=toolbar.config.speed.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';

            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'speed',
    cookieMethod: function () {
        if (toolbar.cookie.getCookie(this.cookieName) === null) {
            this.speed = '中';
        } else {
            this.speed = toolbar.cookie.getCookie(this.cookieName);
        }
    },
    // resetCookie: function () {
    //     toolbar.cookie.setCookie(this.cookieName, 0);
    // },
    speed: '中',
    mainMethod: function () {
        var $readSpeed = $('#speedbutton');

        if (this.speed === '中') {
            this.speed = '快';
            $readSpeed.find('i').attr({
                style: toolbar.config.speed.statebg0
            });
        } else if (this.speed === '快') {
            this.speed = '慢';
            $readSpeed.find('i').attr({
                style: toolbar.config.speed.statebg1
            });
        } else {
            this.speed = '中';
            $readSpeed.find('i').attr({
                style: toolbar.config.speed.style
            });
        }

        toolbar.cookie.setCookie(this.cookieName, this.speed);
    }
};

//鼠标放大功能----------------------------------------
toolbar.Function.mouse = {
    showHTML: function () {
        if (toolbar.config.mouse.show) {
            var statebg = toolbar.config.mouse.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 1) {
                statebg = toolbar.config.mouse.statebg0;
            }
            var resHtml =
                '<li id="mousebutton"><a  title="' +
                toolbar.Function.guidance.infoArry[4].info +
                '" href="javascript:toolbar.Function.mouse.mainMethod()" onmousemove=toolbar.config.mouse.onmousemove(this)  onmouseout=toolbar.config.mouse.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';

            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'mouseState',
    cookieMethod: function () {
        if (ABTConfig.guides.cookieSwitch && toolbar.cookie.getCookie(this.cookieName) == 1) {
            toolbar.Function.mouse.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    mouseState: false,
    mainMethod: function () {
        if (!this.mouseState) {
            var dom = document.createElement('style');
            dom.id = 'mousewrap';
            dom.innerHTML = '* {cursor:url("./js/ABT/skins/jinganGov/images/linkaw.cur"), auto !important;}';
            document.getElementById('container').appendChild(dom);
            $('#mousebutton').find('i').attr({
                style: toolbar.config.mouse.statebg0
            });
            this.mouseState = true;
        } else {
            document.getElementById('mousewrap').remove();
            $('#mousebutton').find('i').attr({
                style: toolbar.config.mouse.style
            });
            this.mouseState = false;
        }
        toolbar.cookie.setCookie(this.cookieName, this.mouseState ? 1 : 0);
    },
    moveGuides: function (e) {}
};

//页面缩放功能--------------------------------------
toolbar.Function.pageZoom = {
    showHTML: function () {
        if (toolbar.config.pageZoom.show) {
            var statebg = toolbar.config.pageZoom.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 1 || toolbar.cookie.getCookie(this.cookieName) === null) {
                statebg = toolbar.config.pageZoom.style;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 1.2) {
                statebg = toolbar.config.pageZoom.statebg0;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 1.4) {
                statebg = toolbar.config.pageZoom.statebg1;
            } else {
                statebg = toolbar.config.pageZoom.statebg2;
            }

            var resHtml =
                '<li id="pagezoomin"><a title="' +
                toolbar.Function.guidance.infoArry[5].info +
                '"  href="javascript:toolbar.Function.pageZoom.mainMethod(1)" onmousemove=toolbar.config.pageZoom.onmousemove(this)  onmouseout=toolbar.config.pageZoom.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
            // return '<li id="pagezoomin"><a href="javascript:toolbar.Function.pageZoom.mainMethod(1)"><i style="background:url(/js/ABT/images/icon4.png)"></i></a></li><li id="pagezoomout"><a href="javascript:toolbar.Function.pageZoom.mainMethod(0)"><img src="/js/ABT/images/icon5.png"></a></li>';
        } else {
            return '';
        }
    },
    cookieName: 'pageZoomState',
    cookieMethod: function () {
        if (!ABTConfig.pageZoom.cookieSwitch) {
            return;
        }
        var cookieValue = toolbar.cookie.getCookie(this.cookieName);
        if (cookieValue > 1) {
            cookieValue -= ABTConfig.pageZoom.onceZoom;
            this.pageZoomState = cookieValue;
            toolbar.Function.pageZoom.mainMethod(1);
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 1);
    },
    pageZoomState: 1,
    firstRun: true,
    mainMethod: function (zoomMode) {
        if (!ABTConfig.pageZoom.functionSwitch || getE.error) {
            return;
        }
        var oldPageZoomState = this.pageZoomState;

        if (this.pageZoomState == 1.6) {
            zoomMode = 0;
        }

        if (zoomMode == 1) {
            this.pageZoomState = (this.pageZoomState * 10 + ABTConfig.pageZoom.onceZoom * 10) / 10;
            if (this.pageZoomState > ABTConfig.pageZoom.Max) {
                this.pageZoomState = ABTConfig.pageZoom.Max;
            }
        } else if (zoomMode == 0) {
            this.pageZoomState = 1;
        }

        var $pagezoom = $('#pagezoomin').find('i');

        if (this.pageZoomState == 1) {
            $pagezoom.attr({
                style: toolbar.config.pageZoom.style
            });
        } else if (this.pageZoomState == 1.2) {
            $pagezoom.attr({
                style: toolbar.config.pageZoom.statebg0
            });
        } else if (this.pageZoomState == 1.4) {
            $pagezoom.attr({
                style: toolbar.config.pageZoom.statebg1
            });
        } else {
            $pagezoom.attr({
                style: toolbar.config.pageZoom.statebg2
            });
        }

        var containerWidth = getE.container.offsetWidth / oldPageZoomState;
        var containerHeight = getE.container.offsetHeight / 1;
        getE.container.style.display = 'none';
        if (browserType.ie && browserType.ie != '9.0') {
            if (document.body.offsetWidth > containerWidth * this.pageZoomState) {
                getE.container.style.cssText = 'position:absolute;left:50%;margin:0px;';
                getE.container.style.marginLeft = 0 - Math.round((containerWidth * this.pageZoomState) / 2) + 'px';
            } else {
                getE.container.style.cssText = 'position:absolute;left:0px;margin:0px;';
            }
            getE.container.style.zoom = this.pageZoomState;
        } else {
            var containerX = Math.round(
                (containerWidth * this.pageZoomState - containerWidth) / this.pageZoomState / 2
            );
            var containerY = Math.round(
                (containerHeight * this.pageZoomState - containerHeight) / this.pageZoomState / 2
            );
            var boxTranslate;
            if (containerWidth * this.pageZoomState > document.body.offsetWidth) {
                var fuck = (containerWidth * this.pageZoomState - document.body.offsetWidth) / 2;
                boxTranslate = Math.round(fuck / this.pageZoomState);
            } else {
                boxTranslate = 0;
            }
            var hackCSS = '';
            if (browserType.firefox) {
                hackCSS = '-moz-';
            }
            if (browserType.chrome || browserType.safari) {
                hackCSS = '-webkit-';
              //  document.body.style.height = Math.round(containerHeight * this.pageZoomState) + 'px';
                var bodyWidth;
                var oldBodyWidth = document.body.offsetWidth;
                if (oldBodyWidth < containerWidth * this.pageZoomState && zoomMode == 1) {
                    bodyWidth = Math.round((containerWidth * this.pageZoomState - oldBodyWidth) / this.pageZoomState);
                    // document.body.style.width = Math.round(containerWidth * this.pageZoomState) + 'px';
                    // console.log(boxTranslate);
                    // boxTranslate = boxTranslate*3;
                    // boxTranslate -= bodyWidth / 2;
                }
                if (zoomMode == 0) {
                    // if (screen.width > containerWidth * this.pageZoomState) {
                    //     document.body.style.width = null;
                    // } else {
                    //     document.body.style.width = Math.round(containerWidth * this.pageZoomState) + 'px';
                    // }
                }
            }
            if (browserType.opera) {
                hackCSS = '-o-';
            }
            if (browserType.ie == '9.0') {
                hackCSS = '-ms-';
            }
            getE.container.style.cssText =
                hackCSS + 'transform:scale(' + this.pageZoomState + ')  ;  transform-origin: left top;';
            // console.log($(getE.container).width() / 2);
            $('html').scrollLeft($body.width() / 4);
        }
        if (this.pageZoomState == 1) {
            getE.container.style.cssText = null;
            document.body.style.width = null;
        }
        getE.container.style.display = 'block';
        toolbar.cookie.setCookie(this.cookieName, this.pageZoomState);
    }
};
//字体缩放功能--------------------------------------
toolbar.Function.fontZoom = {
    showHTML: function () {
        if (toolbar.config.fontZoom.show) {
            var statebg = toolbar.config.fontZoom.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 0 || toolbar.cookie.getCookie(this.cookieName) === null) {
                statebg = toolbar.config.fontZoom.style;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 22) {
                statebg = toolbar.config.fontZoom.statebg0;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 30) {
                statebg = toolbar.config.fontZoom.statebg1;
            } else {
                statebg = toolbar.config.fontZoom.statebg2;
            }
            var resHtml =
                '<li id="fontzoomin"><a  title="' +
                toolbar.Function.guidance.infoArry[6].info +
                '" href="javascript:toolbar.Function.fontZoom.mainMethod(1)" onmousemove=toolbar.config.fontZoom.onmousemove(this)  onmouseout=toolbar.config.fontZoom.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
            // return '<li id="fontzoomin"><a href="javascript:toolbar.Function.fontZoom.mainMethod(1)"><img src="/js/ABT/images/icon6.png"></a></li><li id="fontzoomout"><a href="javascript:toolbar.Function.fontZoom.mainMethod(0)" ><img src="/js/ABT/images/icon7.png"></a></li>';
        } else {
            return '';
        }
    },
    cookieName: 'fontZoomState',
    cookieMethod: function () {
        if (!ABTConfig.fontZoom.cookieSwitch) {
            return;
        }
        var cookieValue = toolbar.cookie.getCookie(this.cookieName);
        if (cookieValue != 0 && cookieValue !== null) {
            this.fontZoomState = cookieValue - ABTConfig.fontZoom.onceZoom;
            toolbar.Function.fontZoom.mainMethod(1);
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    fontZoomState: 0,
    mainMethod: function (zoomMode) {
        var $fontZoom = $('#fontzoomin').find('i');

        if (!ABTConfig.fontZoom.functionSwitch || getE.error) {
            return;
        }
        if (this.fontZoomState == 0) {
            this.fontZoomState = ABTConfig.fontZoom.Min;
        }
        if (zoomMode == 1) {
            this.fontZoomState += ABTConfig.fontZoom.onceZoom;
            if (this.fontZoomState > ABTConfig.fontZoom.Max) {
                this.fontZoomState = ABTConfig.fontZoom.Max;
            }
        } else if (zoomMode == 0) {
            this.fontZoomState -= ABTConfig.fontZoom.onceZoom;
            if (this.fontZoomState < ABTConfig.fontZoom.Min) {
                this.fontZoomState = 0;
            }
        }

        if (this.fontZoomState > 38) {
            this.fontZoomState = 0;
        }
        for (var a = 0; a < getE.allElements.length; a++) {
            if (this.fontZoomState > ABTConfig.fontZoom.Min) {
                getE.allElements[a].style.fontSize = this.fontZoomState + 'px';
                getE.allElements[a].style.lineHeight = this.fontZoomState + 2 + 'px';
            } else {
                getE.allElements[a].style.fontSize = null;
                getE.allElements[a].style.lineHeight = null;
            }
        }
        for (var c = 0; c < getE.allFrame.length; c++) {
            var iframeDOM = getE.allFrame[c].contentWindow;
            try {
                var iframeBody = iframeDOM.document.getElementsByTagName('body')[0];
                if (this.fontZoomState > ABTConfig.fontZoom.Min) {
                    for (var d = 0; d < iframeBody.getElementsByTagName('*').length; d++) {
                        iframeBody.getElementsByTagName('*')[d].style.fontSize = this.fontZoomState + 'px';
                        iframeBody.getElementsByTagName('*')[d].style.lineHeight = this.fontZoomState + 2 + 'px';
                    }
                } else {
                    for (var d = 0; d < iframeBody.getElementsByTagName('*').length; d++) {
                        iframeBody.getElementsByTagName('*')[d].style.fontSize = null;
                        iframeBody.getElementsByTagName('*')[d].style.lineHeight = null;
                    }
                }
            } catch (e) {}
        }

        if (this.fontZoomState == 22) {
            $fontZoom.attr({
                style: toolbar.config.fontZoom.statebg0
            });
        } else if (this.fontZoomState == 30) {
            $fontZoom.attr({
                style: toolbar.config.fontZoom.statebg1
            });
        } else if (this.fontZoomState == 38) {
            $fontZoom.attr({
                style: toolbar.config.fontZoom.statebg2
            });
        } else {
            $fontZoom.attr({
                style: toolbar.config.fontZoom.style
            });
        }

        toolbar.cookie.setCookie(this.cookieName, this.fontZoomState);
    }
};
//高对比度功能--------------------------------------
toolbar.Function.hightContrast = {
    showHTML: function () {
        if (ABTConfig.hightContrast.functionSwitch) {
            // var hightContrastHTML =
            //     '<li id="hightcontrast"><a href="javascript:" onmouseover="toolbar.Function.hightContrast.openMenu(0)" onmouseout="toolbar.Function.hightContrast.openMenu(1)" onfocus="toolbar.Function.hightContrast.openMenu(0)"><img src="/js/ABT/images/icon8.png"></a><ul id="hightcontrastlist" onmouseover="toolbar.Function.hightContrast.openMenu(0)" onmouseout="toolbar.Function.hightContrast.openMenu(1)">';
            // hightContrastHTML +=
            //     '<li><a href="javascript:toolbar.Function.hightContrast.mainMethod(-1)">' +
            //     ABTConfig.language.hightContrast.dColor +
            //     '</a></li>';
            // var contrastlist = ABTConfig.hightContrast.delimit;
            // for (var a = 0; a < contrastlist.length; a++) {
            //     hightContrastHTML =
            //         hightContrastHTML +
            //         '<li style="background-color:' +
            //         contrastlist[a].split('|')[1] +
            //         ';"><a href="javascript:toolbar.Function.hightContrast.mainMethod(' +
            //         a +
            //         ')" style="color:' +
            //         contrastlist[a].split('|')[0] +
            //         ';">' +
            //         contrastlist[a].split('|')[2] +
            //         '</a></li>';
            // }
            // hightContrastHTML += '</ul></li>';
            // return hightContrastHTML;

            var statebg = toolbar.config.hightContrast.style;
            if (toolbar.cookie.getCookie(this.cookieName) == -1 || toolbar.cookie.getCookie(this.cookieName) === null) {
                statebg = toolbar.config.hightContrast.style;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 0) {
                statebg = toolbar.config.hightContrast.statebg0;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 1) {
                statebg = toolbar.config.hightContrast.statebg1;
            } else if (toolbar.cookie.getCookie(this.cookieName) == 2) {
                statebg = toolbar.config.hightContrast.statebg2;
            } else {
                statebg = toolbar.config.hightContrast.statebg3;
            }

            var resHtml =
                '<li id="hightcontrast"><a  title="' +
                toolbar.Function.guidance.infoArry[7].info +
                '" href="javascript:toolbar.Function.hightContrast.mainMethod()" onmousemove=toolbar.config.hightContrast.onmousemove(this)  onmouseout=toolbar.config.hightContrast.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'hightContrastState',
    hightContrastState: -1,
    cookieMethod: function () {
        if (!ABTConfig.hightContrast.cookieSwtich) {
            return;
        }
        var cookieValue = toolbar.cookie.getCookie(this.cookieName);
        if (cookieValue != -1 && cookieValue !== null) {
            toolbar.Function.hightContrast.mainMethod(cookieValue);
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, -1);
    },
    openMenu: function (mode) {
        if (mode == 0) {
            document.getElementById('hightcontrastlist').style.display = 'block';
        } else if (mode == 1) {
            document.getElementById('hightcontrastlist').style.display = 'none';
        }
    },
    contrastControl: function (element, mode, q, b) {
        if (mode == 0) {
            element.style.backgroundColor = '';
            element.style.backgroundImage = '';
            element.style.color = '';
        } else if (mode == 1) {
            element.style.backgroundColor = b;
            element.style.backgroundImage = 'none';
            element.style.color = q;
        }
    },
    mainMethod: function (colorNum) {
        if (!ABTConfig.hightContrast.functionSwitch || getE.error) {
            return;
        }

        if (!colorNum) {
            if (this.hightContrastState == 3) {
                colorNum = -1;
            } else {
                colorNum = this.hightContrastState + 1;
            }
        }

        var contrastlist = ABTConfig.hightContrast.delimit;
        if (colorNum != -1) {
            var qcolor = contrastlist[colorNum].split('|')[0];
            var bcolor = contrastlist[colorNum].split('|')[1];
            for (var b = 0; b < getE.allElements.length; b++) {
                this.contrastControl(getE.allElements[b], 1, qcolor, bcolor);
            }
            for (var c = 0; c < getE.allFrame.length; c++) {
                var iframeDOM = getE.allFrame[c].contentWindow;
                try {
                    var iframeBody = iframeDOM.document.getElementsByTagName('body')[0];
                    this.contrastControl(iframeBody, 1, qcolor, bcolor);
                    for (var d = 0; d < iframeBody.getElementsByTagName('*').length; d++) {
                        this.contrastControl(iframeBody.getElementsByTagName('*')[d], 1, qcolor, bcolor);
                    }
                } catch (e) {}
            }
        } else {
            for (var b = 0; b < getE.allElements.length; b++) {
                this.contrastControl(getE.allElements[b], 0);
            }
            for (var c = 0; c < getE.allFrame.length; c++) {
                var iframeDOM = getE.allFrame[c].contentWindow;
                try {
                    var iframeBody = iframeDOM.document.getElementsByTagName('body')[0];
                    this.contrastControl(iframeBody, 0);
                    for (var d = 0; d < iframeBody.getElementsByTagName('*').length; d++) {
                        this.contrastControl(iframeBody.getElementsByTagName('*')[d], 0);
                    }
                } catch (e) {}
            }
        }
        var $highColor = $('#hightcontrast').find('i');

        switch (colorNum) {
            case -1:
                $highColor.attr({
                    style: toolbar.config.hightContrast.style
                });
                break;
            case 0:
                $highColor.attr({
                    style: toolbar.config.hightContrast.statebg0
                });
                break;
            case 1:
                $highColor.attr({
                    style: toolbar.config.hightContrast.statebg1
                });
                break;
            case 2:
                $highColor.attr({
                    style: toolbar.config.hightContrast.statebg2
                });
                break;
            case 3:
                $highColor.attr({
                    style: toolbar.config.hightContrast.statebg3
                });
                break;
            default:
                break;
        }

        this.hightContrastState = colorNum;
        toolbar.cookie.setCookie(this.cookieName, colorNum);
    }
};
//辅助线功能----------------------------------------
toolbar.Function.guides = {
    showHTML: function () {
        if (toolbar.config.guides.show) {
            var statebg = toolbar.config.guides.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 1) {
                statebg = toolbar.config.guides.statebg0;
            }
            // var guidesValue = this.guidesState ? ABTConfig.language.guides.on : ABTConfig.language.guides.off;
            // return '<li id="guidesbutton"><a href="javascript:toolbar.Function.guides.mainMethod()" ><img src="/js/ABT/images/icon9.png"></a></li>';
            var resHtml =
                '<li id="guidesbutton"><a  title="' +
                toolbar.Function.guidance.infoArry[8].info +
                '" href="javascript:toolbar.Function.guides.mainMethod(-1)" onmousemove=toolbar.config.guides.onmousemove(this)  onmouseout=toolbar.config.guides.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'guidesState',
    cookieMethod: function () {
        if (ABTConfig.guides.cookieSwitch && toolbar.cookie.getCookie(this.cookieName) == 1) {
            toolbar.Function.guides.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    guidesState: false,
    mainMethod: function () {
        if (!ABTConfig.guides.functionSwitch) {
            return;
        }
        if (!this.guidesState) {
            var newGuidesBox = document.createElement('div');
            newGuidesBox.setAttribute('id', 'guidesbox');
            newGuidesBox.innerHTML = '<div id="guidesXLine"></div><div id="guidesYLine"></div>';
            document.body.insertBefore(newGuidesBox, getE.container);
            document.getElementById('guidesYLine').style.height = document.body.offsetHeight + 'px';
            document.getElementById('guidesXLine').style.backgroundColor = '#F00';
            document.getElementById('guidesYLine').style.backgroundColor = '#F00';
            if (document.getElementById('guidesbutton')) {
                $('#guidesbutton img').addClass('check');
            }
            document.onmousemove = this.moveGuides;
            window.onscroll = this.moveGuides;
            $('#guidesbutton').find('i').attr({
                style: toolbar.config.guides.statebg0
            });
            this.guidesState = true;
        } else {
            document.getElementById('guidesbox').parentNode.removeChild(document.getElementById('guidesbox'));
            if (document.getElementById('guidesbutton')) {
                $('#guidesbutton img').removeClass('check');
            }
            $('#guidesbutton').find('i').attr({
                style: toolbar.config.guides.style
            });
            this.guidesState = false;
        }
        toolbar.cookie.setCookie(this.cookieName, this.guidesState ? 1 : 0);
    },
    moveGuides: function (e) {
        if (!document.getElementById('guidesbox')) {
            return;
        }
        e = window.event ? window.event : e;
        var guidesX, guidesY;
        document.getElementById('guidesXLine').style.position = 'absolute';
        if (browserType.ie) {
            guidesX = e.clientX + ABTConfig.guides.skew;
            guidesY =
                e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) + ABTConfig.guides.skew;
        } else {
            document.getElementById('guidesXLine').style.position = 'fixed';
            guidesX = e.pageX + ABTConfig.guides.skew;
            guidesY = e.pageY - (document.documentElement.scrollTop || document.body.scrollTop) + ABTConfig.guides.skew;
        }
        document.getElementById('guidesYLine').style.left = guidesX + 'px';
        document.getElementById('guidesXLine').style.top = guidesY + 'px';
    }
};
//超大字幕提示功能--------------------------------------
toolbar.Function.textTips = {
    showHTML: function () {
        if (toolbar.config.textTips.show) {
            var statebg = toolbar.config.textTips.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 1) {
                statebg = toolbar.config.textTips.statebg0;
            }

            //  return '<li id="texttipsbutton"><a href="javascript:toolbar.Function.textTips.mainMethod()"><img src="/js/ABT/images/icon10.png"></a></li>';
            var resHtml =
                '<li id="texttipsbutton"><a title="' +
                toolbar.Function.guidance.infoArry[9].info +
                '"  href="javascript:toolbar.Function.textTips.mainMethod(-1)" onmousemove=toolbar.config.textTips.onmousemove(this)  onmouseout=toolbar.config.textTips.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    textGetState: false,
    cookieName: 'textTips',
    cookieMethod: function () {
        if (ABTConfig.textTips.cookieSwitch && toolbar.cookie.getCookie(this.cookieName) == 1) {
            toolbar.Function.textTips.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    testTipsState: false,
    pinyinState: false,
    allTextNode: new Array(),
    getTextNode: function (element) {
        var childNodes = element.childNodes;
        for (var i = 0; i < childNodes.length; i++) {
            var thisChild = childNodes[i];
            switch (thisChild.nodeType) {
                case 1:
                    this.getTextNode(thisChild);
                    break;
                case 3:
                    if (this.trim(thisChild.nodeValue).length == 0) {
                        break;
                    }
                    this.allTextNode.push(thisChild);
                    break;
            }
            if (
                thisChild.nodeName == 'IMG' ||
                thisChild.nodeName == 'INPUT' ||
                thisChild.nodeName == 'OBJECT' ||
                thisChild.nodeName == 'SELECT'
            ) {
                this.allTextNode.push(thisChild);
            }
        }
    },
    AddTag: function () {
        if (this.firstRun) {
            return;
        }
        for (var a = 0; a < this.allTextNode.length; a++) {
            if (this.allTextNode[a].parentNode.nodeName == 'STYLE') {
                continue;
            }
            if (this.allTextNode[a].parentNode.parentNode.parentNode.getAttribute('id') == 'carlendar') {
                continue;
            }
            var tagNode = document.createElement('em');
            if (
                this.allTextNode[a].nodeName == 'IMG' ||
                this.allTextNode[a].nodeName == 'INPUT' ||
                this.allTextNode[a].nodeName == 'SELECT'
            ) {
                tagNode.setAttribute('class', 'getmessage');
                var newNode = this.allTextNode[a].cloneNode(true);
                tagNode.appendChild(newNode);
            } else if (
                this.allTextNode[a].nodeName == 'OBJECT' &&
                this.allTextNode[a].parentNode.nodeName != 'OBJECT'
            ) {
                tagNode.setAttribute('class', 'getmessage');
                var newNode = this.allTextNode[a].cloneNode(true);
                tagNode.appendChild(newNode);
            } else {
                var newString = this.allTextNode[a].nodeValue;
                var reg = /[，。！？；、：]/;
                if (reg.exec(newString) == null) {
                    tagNode.setAttribute('class', 'getmessage');
                    tagNode.innerHTML = newString;
                } else {
                    tagNode.setAttribute('class', 'getmainmessage');
                    tagNode.innerHTML = this.mySplit(newString, /[，。！？；、：]/);
                }
            }
            if (this.allTextNode[a].parentNode) {
                this.allTextNode[a].parentNode.insertBefore(tagNode, this.allTextNode[a]);
            }
        }
        for (var b = 0; b < this.allTextNode.length; b++) {
            if (this.allTextNode[b].parentNode.nodeName == 'STYLE') {
                continue;
            }
            if (this.allTextNode[b].parentNode.parentNode.parentNode.getAttribute('id') == 'carlendar') {
                continue;
            }
            this.allTextNode[b].parentNode.removeChild(this.allTextNode[b]);
        }
        var allOption = getE.container.getElementsByTagName('option');
        for (var c = 0; c < allOption.length; c++) {
            var thisMessage = allOption[c].firstChild.cloneNode(true);
            allOption[c].innerHTML = '';
            allOption[c].appendChild(thisMessage);
        }
        this.firstRun = true;
    },
    trim: function (str) {
        return str.replace(/(^\s*)|(\s*$)/g, '');
    },
    mySplit: function (str, reg) {
        var result,
            x = str,
            y,
            zzz = true;
        var stringArray = new Array();
        do {
            result = reg.exec(x);
            if (result != null) {
                var stringIndex = result.index;
                stringArray.push(x.substring(0, stringIndex + 1));
                x = x.substring(stringIndex + 1);
            } else {
                stringArray.push(x);
                zzz = false;
            }
        } while (zzz);
        var yy = '<em class="getmessage">';
        for (var a = 0; a < stringArray.length; a++) {
            yy += a < stringArray.length - 1 ? stringArray[a] + '</em><em class="getmessage">' : stringArray[a];
        }
        yy += '</em>';
        return yy;
    },
    getText: function (dom) {
        if (!document.getElementById('gettextmessagecontent')) {
            return;
        }

        function getText(element) {
            var elementText;
            if (
                element.nodeName == 'H1' ||
                element.nodeName == 'H2' ||
                element.nodeName == 'H3' ||
                element.nodeName == 'H4' ||
                element.nodeName == 'H5' ||
                element.nodeName == 'H6'
            ) {
                if (element.firstChild.nodeName == '#text') {
                    if (element.firstChild.nodeValue.trim() == '') {
                        if (element.childNodes.length > 1) {
                            element = element.childNodes[1];
                        } else {
                            element = element.firstChild;
                        }
                    } else {
                        element = element.firstChild;
                    }
                } else {
                    element = element.firstChild;
                }
            }
            if (element.nodeName == '#text') {
                elementText = element.nodeValue;
            } else if (element.nodeName == 'IMG') {
                if (element.getAttribute('alt')) {
                    elementText = element.getAttribute('alt');
                } else if (element.getAttribute('title')) {
                    elementText = element.getAttribute('title');
                } else {
                    elementText = document.title;
                }
            } else {
                elementText = element.innerText || element.textContent;
            }
            return elementText;
        }

        var messagebox = document.getElementById('gettextmessagecontent');
        var textMessage = '';

        if (dom.firstChild.nodeName == 'IMG') {
            if (dom.parentNode.parentNode.nodeName == 'A' || dom.parentNode.nodeName == 'A') {
                textMessage = ABTConfig.language.textTips.textName.tagName1 + '' + getText(dom.firstChild);
            } else {
                textMessage = ABTConfig.language.textTips.textName.tagName2 + '' + getText(dom.firstChild);
            }
        } else if (dom.firstChild.nodeName == 'OBJECT') {
            textMessage = ABTConfig.language.textTips.textName.tagName3 + '' + dom.firstChild.getAttribute('title');
        } else if (dom.firstChild.nodeName == 'SELECT') {
            textMessage = ABTConfig.language.textTips.textName.tagName4;
        } else if (dom.firstChild.nodeName == 'INPUT') {
            var inputType = dom.firstChild.getAttribute('type');
            switch (inputType) {
                case 'button':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName5 + '' + dom.firstChild.getAttribute('value');
                    break;
                case 'image':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName6 + '' + dom.firstChild.getAttribute('alt');
                    break;
                case 'submit':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName7 + '' + dom.firstChild.getAttribute('value');
                    break;
                case 'reset':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName8 + '' + dom.firstChild.getAttribute('value');
                    break;
                case 'file':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName9 + '' + dom.firstChild.getAttribute('title');
                    break;
                case 'password':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName10 + '' + dom.firstChild.getAttribute('title');
                    break;
                case 'radio':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName11 + '' + dom.firstChild.getAttribute('title');
                    break;
                case 'checkbox':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName12 + '' + dom.firstChild.getAttribute('title');
                    break;
                case 'text':
                    textMessage =
                        ABTConfig.language.textTips.textName.tagName13 + '' + dom.firstChild.getAttribute('title');
                    break;
            }
        } else if (dom.parentNode.parentNode.nodeName == 'A' || dom.parentNode.nodeName == 'A') {
            var thisContent;
            if (dom.parentNode.parentNode.nodeName == 'A') {
                if (dom.parentNode.parentNode.getAttribute('title')) {
                    thisContent = dom.parentNode.parentNode.getAttribute('title');
                } else {
                    thisContent = dom.innerText || dom.textContent;
                }
            } else if (dom.parentNode.nodeName == 'A') {
                if (dom.parentNode.getAttribute('title')) {
                    thisContent = dom.parentNode.getAttribute('title');
                } else {
                    thisContent = dom.innerText || dom.textContent;
                }
            }
            textMessage = ABTConfig.language.textTips.textName.tagName14 + '' + thisContent;
        } else if (
            dom.parentNode.nodeName == 'H1' ||
            dom.parentNode.nodeName == 'H2' ||
            dom.parentNode.nodeName == 'H3' ||
            dom.parentNode.nodeName == 'H4' ||
            dom.parentNode.nodeName == 'H5' ||
            dom.parentNode.nodeName == 'H6'
        ) {
            var thisContent = dom.innerText || dom.textContent;
            textMessage = ABTConfig.language.textTips.textName.tagName15 + '' + thisContent;
        } else {
            var thisContent = dom.innerText || dom.textContent;
            textMessage = ABTConfig.language.textTips.textName.tagName16 + '' + thisContent;
        }
        var messageboxWidth = messagebox.offsetWidth;
        var fontRatio = messageboxWidth / textMessage.length;
        //alert(messageboxWidth+"|"+textMessage.length+"|"+fontRatio);
        if (fontRatio < 30) {
            if (fontRatio > 18) {
                messagebox.style.fontSize = parseInt(fontRatio) + 'px';
                messagebox.style.lineHeight = parseInt(fontRatio) + 'px';
            }
            if (fontRatio < 10) {
                messagebox.style.fontSize = parseInt(fontRatio * 2) + 'px';
                messagebox.style.lineHeight = parseInt(fontRatio * 2) + 'px';
            }
        } else {
            messagebox.style.fontSize = '';
        }
        if (toolbar.Function.textTips.pinyinState) {
            textMessage = toolbar.Function.textTips.pinyinText(textMessage);
        }

        if (!toolbar.Function.textTips.simplieState) {
            textMessage = toolbar.Function.textTips.traditionalized(textMessage);
        }

        messagebox.innerHTML = textMessage;
        textMessage = '';

        if (toolbar.Function.textTips.textbgState) {
            dom.style.backgroundColor = '#F00';
            dom.style.color = '#FFF';
        }
    },
    pinyinText: function (text) {
        var messayArray = text.split('');
        var newString = '';
        for (var a = 0; a < messayArray.length; a++) {
            var testVar = '';
            if (pinyin[messayArray[a]]) {
                testVar = pinyin[messayArray[a]];
            } else {
                testVar = '&nbsp;';
            }
            if (messayArray[a] == ' ') {
                messayArray[a] = '&nbsp;';
            }
            newString += '<span>' + messayArray[a] + '<sup>' + testVar + '</sup></span>';
        }
        return newString;
    },
    getEvent: function () {
        // var allSpan = getE.container.getElementsByTagName('em');
        // for (var c = 0; c < allSpan.length; c++) {
        //     if (allSpan[c].getAttribute('class') == 'getmessage') {
        //         allSpan[c].onmouseover = this.getText;
        //         allSpan[c].onmouseout = this.clearTextbg;
        //     }
        // }

        var _this = this;

        $('#container').on('mouseenter', 'em.getmessage', function () {
            _this.getText(this);
        });
    },
    pinyinControl: function () {
        this.pinyinState = this.pinyinState ? false : true;
        if (this.pinyinState) {
            document.getElementById('pinyinbuttonbox').firstChild.innerHTML = ABTConfig.language.textTips.pinyin.on;
        } else {
            document.getElementById('pinyinbuttonbox').firstChild.innerHTML = ABTConfig.language.textTips.pinyin.off;
        }
    },
    firstRun: false,
    textbgState: false,
    textbg: function () {
        this.textbgState = this.textbgState ? false : true;
        document.getElementById('textbgbuttonbox').getElementsByTagName('a')[0].innerHTML = this.textbgState
            ? ABTConfig.language.textTips.textbg.on
            : ABTConfig.language.textTips.textbg.off;
    },
    clearTextbg: function () {
        this.style.backgroundColor = '';
        this.style.color = '';
    },
    simplized: function (cc) {
        var str = '';
        for (var i = 0; i < cc.length; i++) {
            if (toolbar.Function.textTips.ftPYStr().indexOf(cc.charAt(i)) != -1)
                str += toolbar.Function.textTips
                    .charPYStr()
                    .charAt(toolbar.Function.textTips.ftPYStr().indexOf(cc.charAt(i)));
            else str += cc.charAt(i);
        }
        return str;
    },
    traditionalized: function (cc) {
        var str = '';
        for (var i = 0; i < cc.length; i++) {
            if (toolbar.Function.textTips.charPYStr().indexOf(cc.charAt(i)) != -1)
                str += toolbar.Function.textTips
                    .ftPYStr()
                    .charAt(toolbar.Function.textTips.charPYStr().indexOf(cc.charAt(i)));
            else str += cc.charAt(i);
        }
        return str;
    },
    change: function (e) {
        var $abttraditionalbtn = $('#abttraditionalbtn');
        if (e == 1) {
            $abttraditionalbtn.children('a').eq(0).addClass('active').siblings('').removeClass('active');
            this.simplieState = true;
        } else {
            $abttraditionalbtn.children('a').eq(1).addClass('active').siblings('').removeClass('active');
            this.simplieState = false;
        }
    },
    charPYStr: function () {
        return '锕皑蔼碍爱嗳嫒瑷暧霭谙铵鹌肮袄奥媪骜鳌坝罢钯摆败呗颁办绊钣帮绑镑谤剥饱宝报鲍鸨龅辈贝钡狈备惫鹎贲锛绷笔毕毙币闭荜哔滗铋筚跸边编贬变辩辫苄缏笾标骠飑飙镖镳鳔鳖别瘪濒滨宾摈傧缤槟殡膑镔髌鬓饼禀拨钵铂驳饽钹鹁补钸财参蚕残惭惨灿骖黪苍舱仓沧厕侧册测恻层诧锸侪钗搀掺蝉馋谗缠铲产阐颤冁谄谶蒇忏婵骣觇禅镡场尝长偿肠厂畅伥苌怅阊鲳钞车彻砗尘陈衬伧谌榇碜龀撑称惩诚骋枨柽铖铛痴迟驰耻齿炽饬鸱冲冲虫宠铳畴踌筹绸俦帱雠橱厨锄雏础储触处刍绌蹰传钏疮闯创怆锤缍纯鹑绰辍龊辞词赐鹚聪葱囱从丛苁骢枞凑辏蹿窜撺错锉鹾达哒鞑带贷骀绐担单郸掸胆惮诞弹殚赕瘅箪当挡党荡档谠砀裆捣岛祷导盗焘灯邓镫敌涤递缔籴诋谛绨觌镝颠点垫电巅钿癫钓调铫鲷谍叠鲽钉顶锭订铤丢铥东动栋冻岽鸫窦犊独读赌镀渎椟牍笃黩锻断缎簖兑队对怼镦吨顿钝炖趸夺堕铎鹅额讹恶饿谔垩阏轭锇锷鹗颚颛鳄诶儿尔饵贰迩铒鸸鲕发罚阀珐矾钒烦贩饭访纺钫鲂飞诽废费绯镄鲱纷坟奋愤粪偾丰枫锋风疯冯缝讽凤沣肤辐抚辅赋复负讣妇缚凫驸绂绋赙麸鲋鳆钆该钙盖赅杆赶秆赣尴擀绀冈刚钢纲岗戆镐睾诰缟锆搁鸽阁铬个纥镉颍给亘赓绠鲠龚宫巩贡钩沟苟构购够诟缑觏蛊顾诂毂钴锢鸪鹄鹘剐挂鸹掴关观馆惯贯诖掼鹳鳏广犷规归龟闺轨诡贵刽匦刿妫桧鲑鳜辊滚衮绲鲧锅国过埚呙帼椁蝈铪骇韩汉阚绗颉号灏颢阂鹤贺诃阖蛎横轰鸿红黉讧荭闳鲎壶护沪户浒鹕哗华画划话骅桦铧怀坏欢环还缓换唤痪焕涣奂缳锾鲩黄谎鳇挥辉毁贿秽会烩汇讳诲绘诙荟哕浍缋珲晖荤浑诨馄阍获货祸钬镬击机积饥迹讥鸡绩缉极辑级挤几蓟剂济计记际继纪讦诘荠叽哜骥玑觊齑矶羁虿跻霁鲚鲫夹荚颊贾钾价驾郏浃铗镓蛲歼监坚笺间艰缄茧检碱硷拣捡简俭减荐槛鉴践贱见键舰剑饯渐溅涧谏缣戋戬睑鹣笕鲣鞯将浆蒋桨奖讲酱绛缰胶浇骄娇搅铰矫侥脚饺缴绞轿较挢峤鹪鲛阶节洁结诫届疖颌鲒紧锦仅谨进晋烬尽劲荆茎卺荩馑缙赆觐鲸惊经颈静镜径痉竞净刭泾迳弪胫靓纠厩旧阄鸠鹫驹举据锯惧剧讵屦榉飓钜锔窭龃鹃绢锩镌隽觉决绝谲珏钧军骏皲开凯剀垲忾恺铠锴龛闶钪铐颗壳课骒缂轲钶锞颔垦恳龈铿抠库裤喾块侩郐哙脍宽狯髋矿旷况诓诳邝圹纩贶亏岿窥馈溃匮蒉愦聩篑阃锟鲲扩阔蛴蜡腊莱来赖崃徕涞濑赉睐铼癞籁蓝栏拦篮阑兰澜谰揽览懒缆烂滥岚榄斓镧褴琅阆锒捞劳涝唠崂铑铹痨乐鳓镭垒类泪诔缧篱狸离鲤礼丽厉励砾历沥隶俪郦坜苈莅蓠呖逦骊缡枥栎轹砺锂鹂疠粝跞雳鲡鳢俩联莲连镰怜涟帘敛脸链恋炼练蔹奁潋琏殓裢裣鲢粮凉两辆谅魉疗辽镣缭钌鹩猎临邻鳞凛赁蔺廪檩辚躏龄铃灵岭领绫棂蛏鲮馏刘浏骝绺镏鹨龙聋咙笼垄拢陇茏泷珑栊胧砻楼娄搂篓偻蒌喽嵝镂瘘耧蝼髅芦卢颅庐炉掳卤虏鲁赂禄录陆垆撸噜闾泸渌栌橹轳辂辘氇胪鸬鹭舻鲈峦挛孪滦乱脔娈栾鸾銮抡轮伦仑沦纶论囵萝罗逻锣箩骡骆络荦猡泺椤脶镙驴吕铝侣屡缕虑滤绿榈褛锊呒妈玛码蚂马骂吗唛嬷杩买麦卖迈脉劢瞒馒蛮满谩缦镘颡鳗猫锚铆贸麽没镁门闷们扪焖懑钔锰梦眯谜弥觅幂芈谧猕祢绵缅渑腼黾庙缈缪灭悯闽闵缗鸣铭谬谟蓦馍殁镆谋亩钼呐钠纳难挠脑恼闹铙讷馁内拟腻铌鲵撵辇鲶酿鸟茑袅聂啮镊镍陧蘖嗫颟蹑柠狞宁拧泞苎咛聍钮纽脓浓农侬哝驽钕诺傩疟欧鸥殴呕沤讴怄瓯盘蹒庞抛疱赔辔喷鹏纰罴铍骗谝骈飘缥频贫嫔苹凭评泼颇钋扑铺朴谱镤镨栖脐齐骑岂启气弃讫蕲骐绮桤碛颀颃鳍牵钎铅迁签谦钱钳潜浅谴堑佥荨悭骞缱椠钤枪呛墙蔷强抢嫱樯戗炝锖锵镪羟跄锹桥乔侨翘窍诮谯荞缲硗跷窃惬锲箧钦亲寝锓轻氢倾顷请庆揿鲭琼穷茕蛱巯赇虮鳅趋区躯驱龋诎岖阒觑鸲颧权劝诠绻辁铨却鹊确阕阙悫让饶扰绕荛娆桡热韧认纫饪轫荣绒嵘蝾缛铷颦软锐蚬闰润洒萨飒鳃赛伞毵糁丧骚扫缫涩啬铯穑杀刹纱铩鲨筛晒酾删闪陕赡缮讪姗骟钐鳝墒伤赏垧殇觞烧绍赊摄慑设厍滠畲绅审婶肾渗诜谂渖声绳胜师狮湿诗时蚀实识驶势适释饰视试谥埘莳弑轼贳铈鲥寿兽绶枢输书赎属术树竖数摅纾帅闩双谁税顺说硕烁铄丝饲厮驷缌锶鸶耸怂颂讼诵擞薮馊飕锼苏诉肃谡稣虽随绥岁谇孙损笋荪狲缩琐锁唢睃獭挞闼铊鳎台态钛鲐摊贪瘫滩坛谭谈叹昙钽锬顸汤烫傥饧铴镗涛绦讨韬铽腾誊锑题体屉缇鹈阗条粜龆鲦贴铁厅听烃铜统恸头钭秃图钍团抟颓蜕饨脱鸵驮驼椭箨鼍袜娲腽弯湾顽万纨绾网辋韦违围为潍维苇伟伪纬谓卫诿帏闱沩涠玮韪炜鲔温闻纹稳问阌瓮挝蜗涡窝卧莴龌呜钨乌诬无芜吴坞雾务误邬庑怃妩骛鹉鹜锡牺袭习铣戏细饩阋玺觋虾辖峡侠狭厦吓硖鲜纤贤衔闲显险现献县馅羡宪线苋莶藓岘猃娴鹇痫蚝籼跹厢镶乡详响项芗饷骧缃飨萧嚣销晓啸哓潇骁绡枭箫协挟携胁谐写泻谢亵撷绁缬锌衅兴陉荥凶汹锈绣馐鸺虚嘘须许叙绪续诩顼轩悬选癣绚谖铉镟学谑泶鳕勋询寻驯训讯逊埙浔鲟压鸦鸭哑亚讶垭娅桠氩阉烟盐严岩颜阎艳厌砚彦谚验厣赝俨兖谳恹闫酽魇餍鼹鸯杨扬疡阳痒养样炀瑶摇尧遥窑谣药轺鹞鳐爷页业叶靥谒邺晔烨医铱颐遗仪蚁艺亿忆义诣议谊译异绎诒呓峄饴怿驿缢轶贻钇镒镱瘗舣荫阴银饮隐铟瘾樱婴鹰应缨莹萤营荧蝇赢颖茔莺萦蓥撄嘤滢潆璎鹦瘿颏罂哟拥佣痈踊咏镛优忧邮铀犹诱莸铕鱿舆鱼渔娱与屿语狱誉预驭伛俣谀谕蓣嵛饫阈妪纡觎欤钰鹆鹬龉鸳渊辕园员圆缘远橼鸢鼋约跃钥粤悦阅钺郧匀陨运蕴酝晕韵郓芸恽愠纭韫殒氲杂灾载攒暂赞瓒趱錾赃脏驵凿枣责择则泽赜啧帻箦贼谮赠综缯轧铡闸栅诈斋债毡盏斩辗崭栈战绽谵张涨帐账胀赵诏钊蛰辙锗这谪辄鹧贞针侦诊镇阵浈缜桢轸赈祯鸩挣睁狰争帧症郑证诤峥钲铮筝织职执纸挚掷帜质滞骘栉栀轵轾贽鸷蛳絷踬踯觯钟终种肿众锺诌轴皱昼骤纣绉猪诸诛烛瞩嘱贮铸驻伫槠铢专砖转赚啭馔颞桩庄装妆壮状锥赘坠缀骓缒谆准着浊诼镯兹资渍谘缁辎赀眦锱龇鲻踪总纵偬邹诹驺鲰诅组镞钻缵躜鳟翱并卜沉丑淀迭斗范干皋硅柜后伙秸杰诀夸里凌么霉捻凄扦圣尸抬涂洼喂污锨咸蝎彝涌游吁御愿岳云灶扎札筑于志注凋讠谫郄勐凼坂垅垴埯埝苘荬荮莜莼菰藁揸吒吣咔咝咴噘噼嚯幞岙嵴彷徼犸狍馀馇馓馕愣憷懔丬溆滟溷漤潴澹甯纟绔绱珉枧桊桉槔橥轱轷赍肷胨飚煳煅熘愍淼砜磙眍钚钷铘铞锃锍锎锏锘锝锪锫锿镅镎镢镥镩镲稆鹋鹛鹱疬疴痖癯裥襁耢颥螨麴鲅鲆鲇鲞鲴鲺鲼鳊鳋鳘鳙鞒鞴齄';
    },
    ftPYStr: function () {
        return '錒皚藹礙愛噯嬡璦曖靄諳銨鵪骯襖奧媼驁鰲壩罷鈀擺敗唄頒辦絆鈑幫綁鎊謗剝飽寶報鮑鴇齙輩貝鋇狽備憊鵯賁錛繃筆畢斃幣閉蓽嗶潷鉍篳蹕邊編貶變辯辮芐緶籩標驃颮飆鏢鑣鰾鱉別癟瀕濱賓擯儐繽檳殯臏鑌髕鬢餅稟撥缽鉑駁餑鈸鵓補鈽財參蠶殘慚慘燦驂黲蒼艙倉滄廁側冊測惻層詫鍤儕釵攙摻蟬饞讒纏鏟產闡顫囅諂讖蕆懺嬋驏覘禪鐔場嘗長償腸廠暢倀萇悵閶鯧鈔車徹硨塵陳襯傖諶櫬磣齔撐稱懲誠騁棖檉鋮鐺癡遲馳恥齒熾飭鴟沖衝蟲寵銃疇躊籌綢儔幬讎櫥廚鋤雛礎儲觸處芻絀躕傳釧瘡闖創愴錘綞純鶉綽輟齪辭詞賜鶿聰蔥囪從叢蓯驄樅湊輳躥竄攛錯銼鹺達噠韃帶貸駘紿擔單鄲撣膽憚誕彈殫賧癉簞當擋黨蕩檔讜碭襠搗島禱導盜燾燈鄧鐙敵滌遞締糴詆諦綈覿鏑顛點墊電巔鈿癲釣調銚鯛諜疊鰈釘頂錠訂鋌丟銩東動棟凍崠鶇竇犢獨讀賭鍍瀆櫝牘篤黷鍛斷緞籪兌隊對懟鐓噸頓鈍燉躉奪墮鐸鵝額訛惡餓諤堊閼軛鋨鍔鶚顎顓鱷誒兒爾餌貳邇鉺鴯鮞發罰閥琺礬釩煩販飯訪紡鈁魴飛誹廢費緋鐨鯡紛墳奮憤糞僨豐楓鋒風瘋馮縫諷鳳灃膚輻撫輔賦復負訃婦縛鳧駙紱紼賻麩鮒鰒釓該鈣蓋賅桿趕稈贛尷搟紺岡剛鋼綱崗戇鎬睪誥縞鋯擱鴿閣鉻個紇鎘潁給亙賡綆鯁龔宮鞏貢鉤溝茍構購夠詬緱覯蠱顧詁轂鈷錮鴣鵠鶻剮掛鴰摑關觀館慣貫詿摜鸛鰥廣獷規歸龜閨軌詭貴劊匭劌媯檜鮭鱖輥滾袞緄鯀鍋國過堝咼幗槨蟈鉿駭韓漢闞絎頡號灝顥閡鶴賀訶闔蠣橫轟鴻紅黌訌葒閎鱟壺護滬戶滸鶘嘩華畫劃話驊樺鏵懷壞歡環還緩換喚瘓煥渙奐繯鍰鯇黃謊鰉揮輝毀賄穢會燴匯諱誨繪詼薈噦澮繢琿暉葷渾諢餛閽獲貨禍鈥鑊擊機積饑跡譏雞績緝極輯級擠幾薊劑濟計記際繼紀訐詰薺嘰嚌驥璣覬齏磯羈蠆躋霽鱭鯽夾莢頰賈鉀價駕郟浹鋏鎵蟯殲監堅箋間艱緘繭檢堿鹼揀撿簡儉減薦檻鑒踐賤見鍵艦劍餞漸濺澗諫縑戔戩瞼鶼筧鰹韉將漿蔣槳獎講醬絳韁膠澆驕嬌攪鉸矯僥腳餃繳絞轎較撟嶠鷦鮫階節潔結誡屆癤頜鮚緊錦僅謹進晉燼盡勁荊莖巹藎饉縉贐覲鯨驚經頸靜鏡徑痙競凈剄涇逕弳脛靚糾廄舊鬮鳩鷲駒舉據鋸懼劇詎屨櫸颶鉅鋦窶齟鵑絹錈鐫雋覺決絕譎玨鈞軍駿皸開凱剴塏愾愷鎧鍇龕閌鈧銬顆殼課騍緙軻鈳錁頷墾懇齦鏗摳庫褲嚳塊儈鄶噲膾寬獪髖礦曠況誆誑鄺壙纊貺虧巋窺饋潰匱蕢憒聵簣閫錕鯤擴闊蠐蠟臘萊來賴崍徠淶瀨賚睞錸癩籟藍欄攔籃闌蘭瀾讕攬覽懶纜爛濫嵐欖斕鑭襤瑯閬鋃撈勞澇嘮嶗銠鐒癆樂鰳鐳壘類淚誄縲籬貍離鯉禮麗厲勵礫歷瀝隸儷酈壢藶蒞蘺嚦邐驪縭櫪櫟轢礪鋰鸝癘糲躒靂鱺鱧倆聯蓮連鐮憐漣簾斂臉鏈戀煉練蘞奩瀲璉殮褳襝鰱糧涼兩輛諒魎療遼鐐繚釕鷯獵臨鄰鱗凜賃藺廩檁轔躪齡鈴靈嶺領綾欞蟶鯪餾劉瀏騮綹鎦鷚龍聾嚨籠壟攏隴蘢瀧瓏櫳朧礱樓婁摟簍僂蔞嘍嶁鏤瘺耬螻髏蘆盧顱廬爐擄鹵虜魯賂祿錄陸壚擼嚕閭瀘淥櫨櫓轤輅轆氌臚鸕鷺艫鱸巒攣孿灤亂臠孌欒鸞鑾掄輪倫侖淪綸論圇蘿羅邏鑼籮騾駱絡犖玀濼欏腡鏍驢呂鋁侶屢縷慮濾綠櫚褸鋝嘸媽瑪碼螞馬罵嗎嘜嬤榪買麥賣邁脈勱瞞饅蠻滿謾縵鏝顙鰻貓錨鉚貿麼沒鎂門悶們捫燜懣鍆錳夢瞇謎彌覓冪羋謐獼禰綿緬澠靦黽廟緲繆滅憫閩閔緡鳴銘謬謨驀饃歿鏌謀畝鉬吶鈉納難撓腦惱鬧鐃訥餒內擬膩鈮鯢攆輦鯰釀鳥蔦裊聶嚙鑷鎳隉蘗囁顢躡檸獰寧擰濘苧嚀聹鈕紐膿濃農儂噥駑釹諾儺瘧歐鷗毆嘔漚謳慪甌盤蹣龐拋皰賠轡噴鵬紕羆鈹騙諞駢飄縹頻貧嬪蘋憑評潑頗釙撲鋪樸譜鏷鐠棲臍齊騎豈啟氣棄訖蘄騏綺榿磧頎頏鰭牽釬鉛遷簽謙錢鉗潛淺譴塹僉蕁慳騫繾槧鈐槍嗆墻薔強搶嬙檣戧熗錆鏘鏹羥蹌鍬橋喬僑翹竅誚譙蕎繰磽蹺竊愜鍥篋欽親寢鋟輕氫傾頃請慶撳鯖瓊窮煢蛺巰賕蟣鰍趨區軀驅齲詘嶇闃覷鴝顴權勸詮綣輇銓卻鵲確闋闕愨讓饒擾繞蕘嬈橈熱韌認紉飪軔榮絨嶸蠑縟銣顰軟銳蜆閏潤灑薩颯鰓賽傘毿糝喪騷掃繅澀嗇銫穡殺剎紗鎩鯊篩曬釃刪閃陜贍繕訕姍騸釤鱔墑傷賞坰殤觴燒紹賒攝懾設厙灄畬紳審嬸腎滲詵諗瀋聲繩勝師獅濕詩時蝕實識駛勢適釋飾視試謚塒蒔弒軾貰鈰鰣壽獸綬樞輸書贖屬術樹豎數攄紓帥閂雙誰稅順說碩爍鑠絲飼廝駟緦鍶鷥聳慫頌訟誦擻藪餿颼鎪蘇訴肅謖穌雖隨綏歲誶孫損筍蓀猻縮瑣鎖嗩脧獺撻闥鉈鰨臺態鈦鮐攤貪癱灘壇譚談嘆曇鉭錟頇湯燙儻餳鐋鏜濤絳討韜鋱騰謄銻題體屜緹鵜闐條糶齠鰷貼鐵廳聽烴銅統慟頭鈄禿圖釷團摶頹蛻飩脫鴕馱駝橢籜鼉襪媧膃彎灣頑萬紈綰網輞韋違圍為濰維葦偉偽緯謂衛諉幃闈溈潿瑋韙煒鮪溫聞紋穩問閿甕撾蝸渦窩臥萵齷嗚鎢烏誣無蕪吳塢霧務誤鄔廡憮嫵騖鵡鶩錫犧襲習銑戲細餼鬩璽覡蝦轄峽俠狹廈嚇硤鮮纖賢銜閑顯險現獻縣餡羨憲線莧薟蘚峴獫嫻鷴癇蠔秈躚廂鑲鄉詳響項薌餉驤緗饗蕭囂銷曉嘯嘵瀟驍綃梟簫協挾攜脅諧寫瀉謝褻擷紲纈鋅釁興陘滎兇洶銹繡饈鵂虛噓須許敘緒續詡頊軒懸選癬絢諼鉉鏇學謔澩鱈勛詢尋馴訓訊遜塤潯鱘壓鴉鴨啞亞訝埡婭椏氬閹煙鹽嚴巖顏閻艷厭硯彥諺驗厴贗儼兗讞懨閆釅魘饜鼴鴦楊揚瘍陽癢養樣煬瑤搖堯遙窯謠藥軺鷂鰩爺頁業葉靨謁鄴曄燁醫銥頤遺儀蟻藝億憶義詣議誼譯異繹詒囈嶧飴懌驛縊軼貽釔鎰鐿瘞艤蔭陰銀飲隱銦癮櫻嬰鷹應纓瑩螢營熒蠅贏穎塋鶯縈鎣攖嚶瀅瀠瓔鸚癭頦罌喲擁傭癰踴詠鏞優憂郵鈾猶誘蕕銪魷輿魚漁娛與嶼語獄譽預馭傴俁諛諭蕷崳飫閾嫗紆覦歟鈺鵒鷸齬鴛淵轅園員圓緣遠櫞鳶黿約躍鑰粵悅閱鉞鄖勻隕運蘊醞暈韻鄆蕓惲慍紜韞殞氳雜災載攢暫贊瓚趲鏨贓臟駔鑿棗責擇則澤賾嘖幘簀賊譖贈綜繒軋鍘閘柵詐齋債氈盞斬輾嶄棧戰綻譫張漲帳賬脹趙詔釗蟄轍鍺這謫輒鷓貞針偵診鎮陣湞縝楨軫賑禎鴆掙睜猙爭幀癥鄭證諍崢鉦錚箏織職執紙摯擲幟質滯騭櫛梔軹輊贄鷙螄縶躓躑觶鐘終種腫眾鍾謅軸皺晝驟紂縐豬諸誅燭矚囑貯鑄駐佇櫧銖專磚轉賺囀饌顳樁莊裝妝壯狀錐贅墜綴騅縋諄準著濁諑鐲茲資漬諮緇輜貲眥錙齜鯔蹤總縱傯鄒諏騶鯫詛組鏃鉆纘躦鱒翺並蔔沈醜澱叠鬥範幹臯矽櫃後夥稭傑訣誇裏淩麽黴撚淒扡聖屍擡塗窪餵汙鍁鹹蠍彜湧遊籲禦願嶽雲竈紮劄築於誌註雕訁譾郤猛氹阪壟堖垵墊檾蕒葤蓧蒓菇槁摣咤唚哢噝噅撅劈謔襆嶴脊仿僥獁麅餘餷饊饢楞怵懍爿漵灩混濫瀦淡寧糸絝緔瑉梘棬案橰櫫軲軤賫膁腖飈糊煆溜湣渺碸滾瞘鈈鉕鋣銱鋥鋶鐦鐧鍩鍀鍃錇鎄鎇鎿鐝鑥鑹鑔穭鶓鶥鸌癧屙瘂臒襇繈耮顬蟎麯鮁鮃鮎鯗鯝鯴鱝鯿鰠鰵鱅鞽韝齇';
    },
    simplieState: true,
    mainMethod: function () {
        if (!ABTConfig.textTips.functionSwitch || getE.error) {
            return;
        }
        if (!this.textGetState) {
            var newMessageBox = document.createElement('div');
            newMessageBox.setAttribute('id', 'gettextmessagebox');
            newMessageBox.innerHTML =
                '<div class="abt-traditional" id="abttraditionalbtn"><a href="javascript:;" class="active" onclick="toolbar.Function.textTips.change(1)">简</a><a href="javascript:;" onclick="toolbar.Function.textTips.change(2)">繁</a></div>' +
                '<div id="closetextmessagebox"><a href="javascript:" class="abt-close pingyinbtn" style="background-color:" onclick="toolbar.Function.textTips.mainMethod()">关闭</a></div><div id="textbgbuttonbox"><a href="javascript:" class="pingyinbtn abt-biaoji" onclick="toolbar.Function.textTips.textbg()">' +
                ABTConfig.language.textTips.textbg.off +
                '</a></div><div id="pinyinbuttonbox"><a href="javascript:" class="pingyinbtn" onclick="toolbar.Function.textTips.pinyinControl()">' +
                ABTConfig.language.textTips.pinyin.off +
                '</a></div><div id="gettextmessagecontent"></div>';
            document.body.insertBefore(newMessageBox, getE.container);
            document.body.style.paddingBottom = 140 + 'px';
            document.getElementById('pinyinbuttonbox').firstChild.focus();
            this.getTextNode(getE.container);
            this.AddTag();
            this.getEvent();
            $('#texttipsbutton').find('i').attr({
                style: toolbar.config.textTips.statebg0
            });
            this.textGetState = true;
        } else {
            document.body.removeChild(document.getElementById('gettextmessagebox'));
            document.body.style.paddingBottom = 0 + 'px';
            $('#texttipsbutton').find('i').attr({
                style: toolbar.config.textTips.style
            });
            this.textGetState = false;
        }
        toolbar.cookie.setCookie(this.cookieName, this.textGetState ? 1 : 0);
    }
};
//纯文本模式功能------------------------------------
toolbar.Function.textMode = {
    showHTML: function () {
        if (toolbar.config.textMode.show) {
            var buttonText = this.textModeState ? ABTConfig.language.textMode.on : ABTConfig.language.textMode.off;
            // return '<li id="textmodebutton"><a href="javascript:toolbar.Function.textMode.mainMethod()"><img src="/js/ABT/images/icon3.png"></a></li>';

            var statebg = toolbar.config.textMode.style;
            if (toolbar.cookie.getCookie(this.cookieName) == 1) {
                statebg = toolbar.config.textMode.statebg0;
            }
            var resHtml =
                '<li id="textmodebutton"><a  title="' +
                toolbar.Function.guidance.infoArry[10].info +
                '" href="javascript:toolbar.Function.textMode.mainMethod(-1)" onmousemove=toolbar.config.textMode.onmousemove(this)  onmouseout=toolbar.config.textMode.onmouseout(this)><i style="' +
                statebg +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    keyTrigger: function (keyString) {
        var shortcuts = ABTConfig.textMode.KeyCode;
        for (var a = 0; a < shortcuts.length; a++) {
            if (keyString == keyCodeStringHandle(shortcuts[a])) {
                toolbar.Function.textMode.mainMethod();
            }
        }
    },
    cookieName: 'textModeState',
    cookieMethod: function () {
        if (ABTConfig.textMode.cookieSwitch && toolbar.cookie.getCookie(this.cookieName) == 1) {
            toolbar.Function.textMode.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    textModeState: false,
    mainMethod: function () {
        if (!ABTConfig.textMode.functionSwitch || getE.error) {
            return;
        }
        if (!this.textModeState) {
            $('#textmodebutton').find('i').attr({
                style: toolbar.config.textMode.statebg0
            });

            getE.container.style.display = 'none';
            for (var c = 0; c < getE.allFrame.length; c++) {
                var iframeDOM = getE.allFrame[c].contentWindow;
                var newFrameContainer = document.createElement('div');
                try {
                    newFrameContainer.innerHTML = iframeDOM.document.body.innerHTML;
                } catch (z) {}
                getE.allFrame[c].parentNode.insertBefore(newFrameContainer, getE.allFrame[c]);
            }
            while (getE.allFrame.length) {
                getE.allFrame[0].parentNode.removeChild(getE.allFrame[0]);
            }
            for (var d = 0; d < getE.allImg.length; d++) {
                var newImgContainer = document.createElement('span');
                newImgContainer.innerHTML = getText(getE.allImg[d]);
                getE.allImg[d].parentNode.insertBefore(newImgContainer, getE.allImg[d]);
            }
            while (getE.allImg.length) {
                getE.allImg[0].parentNode.removeChild(getE.allImg[0]);
            }
            var textModeStyleUrl = URLPrefix + '/skins/textMode.css';
            for (var a = 0; a < getE.allStyle.length; a++) {
                if (getE.allStyle[a].getAttribute('id') != 'ABTStyle') {
                    getE.allStyle[a].setAttribute('href', '#');
                }
            }
            var textModeStyle = document.createElement('link');
            textModeStyle.setAttribute('rel', 'stylesheet');
            textModeStyle.setAttribute('type', 'text/css');
            textModeStyle.setAttribute('href', textModeStyleUrl);
            document.getElementsByTagName('head')[0].appendChild(textModeStyle);

            for (var b = 0; b < getE.allElements.length; b++) {
                getE.allElements[b].style.height = null;
            }
            if (document.getElementById('textmodebutton')) {
                $('#textmodebutton img').addClass('check');
            }
            getE.container.style.display = 'block';
            this.textModeState = true;
            toolbar.cookie.setCookie(this.cookieName, this.textModeState ? 1 : 0);
            //	读屏提示
            if (langCode == 'cn') {
                skipElementBuild(document.body.firstChild, '您当前处于纯文本模式，可以ALT+SHIFT+J返回可视化模式');
            }
            toolbar.config.textMode.callback();
        } else {
            this.textModeState = false;
            toolbar.cookie.setCookie(this.cookieName, this.textModeState ? 1 : 0);
            window.location.href = window.location.href;
            window.location.reload();
        }
    }
};

//使用引导-------------------------------
toolbar.Function.guidance = {
    showHTML: function () {
        if (toolbar.config.textMode.show) {
            var resHtml =
                '<li id="guidancebutton"><a  title="' +
                toolbar.Function.guidance.infoArry[11].info +
                '" href="javascript:toolbar.Function.guidance.mainMethod()"   onmousemove=toolbar.config.guidance.onmousemove(this)  onmouseout=toolbar.config.guidance.onmouseout(this)><i style="' +
                toolbar.config.guidance.style +
                '"></i></a></li>';

            return resHtml;
        } else {
            return '';
        }
    },
    cookieName: 'mouseState',
    cookieMethod: function () {
        if (ABTConfig.guides.cookieSwitch && toolbar.cookie.getCookie(this.cookieName) == 1) {
            toolbar.Function.oldstate.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 0);
    },
    index: 1,
    infoArry: [
        {
            info: '模式切换，长者模式选择，可根据个人实际需要选择三种长者模式：普通模式、中等模式和高等模式，快捷键：【Shift+M】'
        },
        {
            info: '语音指读，当用户鼠标移到网页文本上时将自动语音阅读，快捷键：【Shift+F】'
        },
        {
            info: '语音播报，将使用语音自动连续播报页面内容。快捷键：【Shift+C】'
        },
        {
            info: '语速调节，可对页面语音阅读速度进行调节，3种速度可选：分别是缓慢语速、正常语速、加快语速，快捷键：【SHIFT+H】'
        },
        {
            info: '大指针，可把当前网页中鼠标改为大指针，让用户浏览网页的鼠标位置更加明显，快捷键：【Shift+D】'
        },
        {
            info: '页面缩放，可对页面进行放大或缩小，根据个人视力情况有3档页面缩放级别可选，快捷键：【Shift+Y】'
        },
        {
            info: '字体放大，可把网页上的文字大小按比例放大。根据个人视力情况有3种字号放大级别可选。快捷键：【Shift+Z】'
        },
        {
            info: '高对比度，可根据个人的色觉障碍特点改变页面的配色，4种配色模式可选：分别是蓝底黄字、黄底蓝字、黑底白字、白底黑字。快捷键：【Shift+B】'
        },
        {
            info: '辅助线，为视力障碍用户校对阅读的位置提供帮助，辅助线是横竖两条红色的基准线，快捷键：【SHIFT+S】'
        },
        {
            info: '超大字幕，将在页面下方开启，当用户移到文字上时，超大的文字将在屏幕上显示，更易于识别和阅读，快捷键：【SHIFT+K】'
        },
        {
            info: '纯文本模式，将去掉网页的装饰图片和布局，转换成更易于阅读的纯文字排版布局；快捷键：【Shift+W】'
        },
        {
            info: '引导流程，帮助您了解每个工具的功能，快捷键：【Shift+N】'
        },
        {
            info: '使用帮助，详细介绍工具条的使用帮助功能。快捷键：【SHIFT+问号键】'
        },
        {
            info: '重置无障碍工具条。快捷键：【Shift+R】'
        },
        {
            info: '关闭无障碍工具条，您选择的模式和功能将被记忆。快捷键：【Shift+X】'
        }
    ],
    step: function (e) {
        stopSpeak();
        if (e === 'next') {
            if (this.index == 15) {
                return false;
            }
            this.index++;
        } else if (e === 'prev') {
            if (this.index == 1) {
                return false;
            }
            this.index--;
        } else {
            this.index = e;
        }
        $('#ABTToolbar').attr({ class: 'abt-shadow-ul abt-guide-state' + this.index });
        $('#guidestate').attr({ class: 'abt-guid abt-guide-state' + this.index });
        $('.abt-guid-list')
            .find('li')
            .eq(this.index - 1)
            .addClass('active')
            .siblings()
            .removeClass('active');

        $('#abt-guidinfo').text(this.infoArry[this.index - 1].info);
        if (this.index == 1) {
            $('.abt-prev').addClass('unable');
        } else if (this.index == 15) {
            $('.abt-next').addClass('unable');
        } else {
            $('.abt-arrow-wrap').find('a').removeClass('unable');
        }
        clearTimeout(timerSpeak);
        var _this = this;

        timerSpeak = setTimeout(function () {
            speakText(_this.infoArry[_this.index - 1].info);
        }, 300);
    },
    mouseState: false,
    close: function () {
        $('#ABTToolbar').attr({ class: '' });
        $('#guidestate').remove();
    },
    mainMethod: function () {
        var guidHtml =
            '<div class="abt-guid " id="guidestate">' +
            '<div class="abt-guid-pop">' +
            '<p id="abt-guidinfo">模式切换，长者模式选择，可根据个人实际需要选择三种长者模式：普通模式、中等模式和高等模式，快捷键：【Shift+M】</p>' +
            '<ul class="abt-guid-list clearfix">' +
            '<li class="active" onclick="toolbar.Function.guidance.step(1)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(2)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(3)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(4)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(5)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(6)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(7)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(8)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(9)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(10)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(11)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(12)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(13)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(14)"></li>' +
            '<li onclick="toolbar.Function.guidance.step(15)"></li>' +
            '</ul>' +
            '<div class="abt-guid-btnwrap">' +
            '<a class="abt-close-guid" onclick="toolbar.Function.guidance.close()" href="javascript:;">忽略</a>' +
            '<div class="abt-arrow-wrap r">' +
            '<a class="abt-prev unable" onclick="toolbar.Function.guidance.step(\'prev\')" href="javascript:;">上一个</a>' +
            '<a class="abt-next" onclick="toolbar.Function.guidance.step(\'next\')" href="javascript:;">下一个</a>' +
            '</div>' +
            '</div>' +
            '</div>' +
            '</div>';

        $('#ABTToolbar').addClass('abt-shadow-ul');
        $body.append(guidHtml);
        $('#ABTToolbar').addClass('abt-guide-state1');
        $('#guidestate').addClass('abt-guide-state1');

        var _this = this;
        timerSpeak = setTimeout(function () {
            speakText(_this.infoArry[0].info);
        }, 300);
    }
};

//帮助功能------------------------------------------
toolbar.Function.help = {
    showHTML: function () {
        if (toolbar.config.help.show) {
            // var tempHTML =
            //    '<li id="ABTHelpbutton"><a target="_blank" href="/js/ABT/网站无障碍声明及操作说明.html"><img src="/js/ABT/images/icon11.png"></a></li>';
            //if (langCode == "cn") { tempHTML = tempHTML + "<li id=\"ABTHelp_talk\"><a target=\"_blank\" href=\"http://www.yingkou.gov.cn/007/007007/20190505/ba797473-f355-4420-ae97-d97b965e182d.html\"><img src=\"/js/ABT/images/icon12.png\"></a></li>"; }
            // return tempHTML;
            var resHtml =
                '<li id="ABTHelpbutton"><a  title="' +
                toolbar.Function.guidance.infoArry[12].info +
                '" target="_blank" href="/js/ABT/网站无障碍声明及操作说明.html" onmousemove=toolbar.config.help.onmousemove(this)  onmouseout=toolbar.config.help.onmouseout(this)><i style="' +
                toolbar.config.help.style +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    }
};

//重置功能------------------------------------------
toolbar.Function.resetToolbar = {
    showHTML: function () {
        if (ABTConfig.resetToolbar.functionSwitch) {
            //return '<li id="resetbutton"><a href="javascript:toolbar.Function.resetToolbar.mainMethod()"><img src="/js/ABT/images/icon13.png"></a></li>';
            var resHtml =
                '<li id="resetbutton"><a title="' +
                toolbar.Function.guidance.infoArry[13].info +
                '"  href="javascript:toolbar.Function.resetToolbar.mainMethod()"   onmousemove=toolbar.config.resetToolbar.onmousemove(this)  onmouseout=toolbar.config.resetToolbar.onmouseout(this)><i style="' +
                toolbar.config.resetToolbar.style +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    mainMethod: function () {
        if (!ABTConfig.resetToolbar.functionSwitch) {
            return;
        }
        for (var a in toolbar.Function) {
            try {
                toolbar.Function[a].resetCookie();
            } catch (e) {}
        }
        window.location.reload();
    }
};

//开启/关闭功能-------------------------------------
toolbar.Function.show = {
    showHTML: function () {
        if (ABTConfig.show.functionSwitch) {
            //return '<li id="closetoolbar"><a href="javascript:toolbar.Function.show.mainMethod()"><img src="/js/ABT/images/icon14.png"></a></li>';

            var resHtml =
                '<li id="closetoolbar"><a  title="' +
                toolbar.Function.guidance.infoArry[14].info +
                '" href="javascript:toolbar.Function.show.mainMethod()"   onmousemove=toolbar.config.show.onmousemove(this)  onmouseout=toolbar.config.show.onmouseout(this)><i style="' +
                toolbar.config.show.style +
                '"></i></a></li>';
            return resHtml;
        } else {
            return '';
        }
    },
    keyTrigger: function (keyString) {
        var shortcuts = ABTConfig.show.keyCode;
        for (var a = 0; a < shortcuts.length; a++) {
            if (keyString == keyCodeStringHandle(shortcuts[a])) {
                toolbar.Function.show.mainMethod();
            }
        }
    },
    cookieName: 'toolbarState',
    cookieMethod: function () {
        if (ABTConfig.show.cookieSwtich && toolbar.cookie.getCookie(this.cookieName) == 1) {
            toolbar.Function.show.mainMethod();
        }
    },
    resetCookie: function () {
        toolbar.cookie.setCookie(this.cookieName, 1);
    },
    toolbarState: false,
    mainMethod: function () {
        if (!ABTConfig.show.functionSwitch) {
            return;
        }
        if (!this.toolbarState) {
            if (document.body.clientWidth > 800) {
                $body.css({
                    'margin-top': '100px'
                });
            } else {
                $body.css({
                    'margin-top': '170px'
                });
                toolbar.config.oldstate.show = false;
                toolbar.config.overSound.show = false;
                toolbar.config.mouse.show = false;
                toolbar.config.guides.show = false;
                toolbar.config.textTips.show = false;
                toolbar.config.textMode.show = false;
                toolbar.config.help.show = false;
                toolbar.config.guidance.show = false;
                toolbar.config.pageZoom.show = false;
                // toolbar.config.textTips.show = false;
            }

            speakText(toolbar.config.openSound, false);

            var toolbarHTML = '<div class="toolbarlistwrap"><ul id="toolbarList" >';
            for (var a in toolbar.Function) {
                try {
                    toolbarHTML = toolbarHTML + toolbar.Function[a].showHTML();
                } catch (e) {}
            }
            toolbarHTML = toolbarHTML + '<li id="abtClear"></li></ul></div><div class="abt-guid-shadow"></div>';
            var newToolbar = document.createElement('div');
            newToolbar.setAttribute('id', 'ABTToolbar');
            newToolbar.innerHTML = toolbarHTML;
            document.body.insertBefore(newToolbar, document.body.firstChild);
            var toobarHeight = document.getElementById('ABTToolbar').offsetHeight;
            toobarHeight =
                toobarHeight > ABTConfig.skin[toolbar.skin].bodyPadding * 2.1
                    ? toobarHeight
                    : ABTConfig.skin[toolbar.skin].bodyPadding;
            skipElementBuild(document.getElementById('ABTToolbar').firstChild, ABTConfig.language.toolbarMessage.on);
            this.toolbarState = true;
        } else {
            $body.css({
                'margin-top': 'auto'
            });
            document.body.removeChild(document.getElementById('ABTToolbar'));
            document.body.style.paddingTop = '0px';
            skipElementBuild(document.body.firstChild, ABTConfig.language.toolbarMessage.off);

            //关闭同时关闭所有功能
            for (var a in toolbar.Function) {
                try {
                    toolbar.Function[a].resetCookie();
                } catch (e) {}
            }
            window.location.reload();

            this.toolbarState = false;
        }
        toolbar.cookie.setCookie(this.cookieName, this.toolbarState ? 1 : 0);
    }
};

toolbar.bgState = -1;

/* 快捷键功能 */
document.onkeyup = function (event) {
    var e = event || window.event || arguments.callee.caller.arguments[0];
    if (e.keyCode === 82 && e.shiftKey) {
        //设置重置：SHIFT+C键，所有设置还原到初始模式
        toolbar.Function.resetToolbar.mainMethod();
    } else if (e.keyCode === 77 && e.shiftKey) {
        //适老模式
        toolbar.Function.oldstate.mainMethod();
    } else if (e.keyCode === 70 && e.shiftKey) {
        // 声音开关：SHIFT+A键，通用于语音阅读声音开和关。
        toolbar.Function.overSoundMode.mainMethod();
    } else if (e.keyCode === 87 && e.shiftKey) {
        // 文本切换：SHIFT+T键，循环使用切换文本模式
        toolbar.Function.textMode.mainMethod();
    } else if (e.keyCode === 89 && e.shiftKey) {
        // 放大缩小页面：SHIFT+ y键放大页面
        toolbar.Function.pageZoom.mainMethod(1);
    } else if (e.keyCode === 90 && e.shiftKey) {
        //放大缩放
        toolbar.Function.fontZoom.mainMethod(1);
    } else if (e.keyCode === 68 && e.shiftKey) {
        // 鼠标样式：SHIFT+D键，更换当前页面鼠标样式。
        toolbar.Function.mouse.mainMethod();
    } else if (e.keyCode === 83 && e.shiftKey) {
        // 开关辅助线：SHIFT+S键，循环使用开关鼠标十字定位。
        toolbar.Function.guides.mainMethod();
    } else if (e.keyCode === 75 && e.shiftKey) {
        // 开关文字提示：SHIFT+K键，循环使用开启文字大字显示屏幕。
        toolbar.Function.textTips.mainMethod();
    } else if (e.keyCode === 191 && e.shiftKey) {
        // 开启帮助：SHIFT+问号键，循环使用开启和关闭帮助说明页面。
        window.location.href = '/js/ABT/网站无障碍声明及操作说明.html';
    } else if (e.keyCode === 27 && e.shiftKey) {
        // 退出服务：SHIFT+ESC键，退出服务还原当前网页原始状态。
        toolbar.Function.show.mainMethod();
    } else if (e.keyCode === 67 && e.shiftKey) {
        //连读指读切换
        toolbar.Function.continuous.mainMethod();
    } else if (e.keyCode === 72 && e.shiftKey) {
        //语速调节
        toolbar.Function.speed.mainMethod();
    } else if (e.keyCode === 66 && e.shiftKey) {
        //背景调节
        if (toolbar.bgState > 2) {
            toolbar.bgState = -1;
        } else {
            toolbar.bgState++;
        }
        toolbar.Function.hightContrast.mainMethod(toolbar.bgState);
    } else if (e.keyCode === 78 && e.shiftKey) {
        //引导
        toolbar.Function.guidance.mainMethod();
    } else if (e.keyCode === 9) {
        // console.log(e);
        // console.log();
        // console.log($($(this).context.activeElement).text());
        var textInfo = $($(this).context.activeElement).text();
        speakText(textInfo);
    }
};

toolbar.Function.leafs = [];

toolbar.Function.initRead = function () {
    var treeTraverseRecursion = function (node, visitor, isleaf) {
        _treeTraverseRecursion(node, visitor, isleaf, 0);
    };
    var _treeTraverseRecursion = function (node, visitor, isleaf, depth) {
        if (depth > 1000) return;
        var nodesToVisit = new Array();
        if (node.firstChild && (typeof isleaf != 'function' || !isleaf(node))) nodesToVisit.push(node.firstChild);
        if (node && node.nextSibling) nodesToVisit.push(node.nextSibling);
        if (node) {
            try {
                visitor(node);
            } catch (e) {}
        }
        for (var i = 0; i < nodesToVisit.length; i++) {
            _treeTraverseRecursion(nodesToVisit[i], visitor, isleaf, depth + 1);
        }
    };

    function hasText(node) {
        var hasTextTagset = {
            A: true,
            IMG: true,
            BUTTON: true,
            INPUT: true,
            LABEL: true,
            TEXT: true,
            AREA: true,
            OBJECT: true,
            EMBED: true,
            SELECT: true,
            TEXTAREA: true,
            SPAN: true,
            H1: true,
            H2: true,
            H3: true,
            H4: true,
            H5: true,
            H6: true,
            TEXT: true,
            P: true,
            OPTION: true
        };
        if (hasTextTagset[node.tagName]) return true;
        var text = $(node).text();
        text = removeSpecialCharacters(text);
        if (text && text.length < 4 && !/[\u4E00-\u9FA5\uF900-\uFA2Da-zA-Z0-9]/.test(text)) return false;
        return text && text.length > 0;
    }

    function parentHasNode(node) {
        var $nodeParents = $(node).parents(),
            res = true;
        $nodeParents.each(function (i, item) {
            if ($(item).attr('readindex')) {
                res = false;
            }
        });
        return res;
    }

    function sfitnode(node, leaf) {
        var tagNames = {
            A: true,
            IMG: true,
            BUTTON: true,
            INPUT: true,
            LABEL: true,
            TEXT: true,
            AREA: true,
            OBJECT: true,
            EMBED: true,
            SELECT: true,
            TEXTAREA: true,
            SPAN: true,
            H1: true,
            H2: true,
            H3: true,
            H4: true,
            H5: true,
            H6: true,
            TEXT: true,
            P: true,
            OPTION: true
        };
        // debugger;
        // console.log('s');
        if (!node || !node.tagName) return false;
        if ($(node).hasClass('yx_fit acctext')) return true;
        if ($(node).hasClass('yx_not')) return false;
        if (
            (node.tagName == 'OBJECT' || node.tagName == 'EMBED') &&
            (node.parentNode.tagName == 'BODY' || $(node).attr('id') == 'sm2movie')
        )
            return false;
        if (node.tagName == 'IMG' && !$(node).hasClass('readimg')) return false;
        if (node.tagName == 'P' || node.tagName == 'SPAN') {
            var nodeParents = $(node).parents('a');
            if (nodeParents.length > 0) {
                return false;
            }
        }

        if (
            !tagNames[node.tagName] &&
            (leaf ||
                $(node)
                    .children()
                    .filter(function () {
                        return this.tagName != 'BR' && !$(this).hasClass('accnode');
                    }).length > 0)
        )
            return false;
        if (!hasText(node)) return false;
        if (!parentHasNode(node)) return false;

        return true;
    }

    //检测是否能够添加序列
    function fitNode(node, leaf) {
        // console.log('ss');
        // if (!node || !node.tagName) return false;
        // if ($(node).hasClass('yx_fit acctext')) return true;
        // if ($(node).hasClass('yx_not')) return false;
        // if (
        //     (node.tagName == 'OBJECT' || node.tagName == 'EMBED') &&
        //     (node.parentNode.tagName == 'BODY' || $(node).attr('id') == 'sm2movie')
        // )
        //     return false;
        // if (node.tagName == 'IMG' && ($(node).width() < 50 || $(node).height() < 50)) return false;
        // if (
        //     !tagNames[node.tagName] &&
        //     (leaf ||
        //         $(node)
        //             .children()
        //             .filter(function () {
        //                 return this.tagName != 'BR' && !$(this).hasClass('accnode');
        //             }).length > 0)
        // )
        //     return false;
        // if (!this.hasText(node)) return false;
        // return true;
    }

    treeTraverseRecursion(document.body, function (node) {
        sfitnode(node);
        // fitNode(node, !isfit);
        // var res = fitNode(node, !isfit);
        // console.log(res);

        if (sfitnode(node, true)) {
            toolbar.Function.leafs.push(node);
            // console.log(node);
            $(node)
                .attr('readindex', toolbar.Function.leafs.length - 1)
                .addClass('readindex');
            // if (!assist.module.node.isFocusable(node))
            //     $(node).attr({
            //         "tabindex": "0"
            //     })
        }
    });
};

toolbar.Function.initRead();
